Network.SetReceivingEnabled 设置接收启用

static function SetReceivingEnabled (player : NetworkPlayer, group : int, enabled : bool) : void

Description描述

Enable or disables the reception of messages in a specific group number from a specific player.

启用或禁用一个特定组中来自特定玩家的信息接收。

You can use the when you do not want any network messages coming in for processing at the moment, and then enable it later when you are ready. This is useful to stop network messages until a level is loaded, for example.

在你不行想任何目前处理的网络消息进入的时候可以使用这个函数,然后在你准备好后启用。例如,可用于停止网络消息,直到关卡被加载。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Awake() {
			foreach (NetworkPlayer player in Network.connections) {
			Network.SetReceivingEnabled(player, 0, false);
		}
	}
}
// Stop receiving messages in group 0 from all players (clients)
//停止接收组0所有玩家(客户端)的信息
for (var player : NetworkPlayer in Network.connections)
	Network.SetReceivingEnabled(player, 0, false);
Page last updated: 2011-4-4