public static void RegisterHandler (short msgType, Networking.NetworkMessageDelegate handler);

파라미터

msgType Message type number.
handler Function handler which will be invoked for when this message type is received.

설명

Register a handler for a particular message type.

There are several system message types which you can add handlers for. You can also add your own message types.

class MyServer
{
	void Start()
	{
	    NetworkServer.Listen(7070);
	    Debug.Log ("Registering server callbacks");
	    NetworkServer.RegisterHandler(MsgType.Connect, OnConnected);
	}

void OnConnected(NetworkMessage netMsg) { Debug.Log ("Client connected"); } }

The system message types are listed below:

class MsgType
{
	public const short ObjectDestroy = 1;
	public const short Rpc = 2;
	public const short ObjectSpawn = 3;
	public const short Owner = 4;
	public const short Command = 5;
	public const short LocalPlayerTransform = 6;
	public const short SyncEvent = 7;
	public const short UpdateVars = 8;
	public const short SyncList = 9;
	public const short ObjectSpawnScene = 10;
	public const short NetworkInfo = 11;
	public const short SpawnFinished = 12;
	public const short ObjectHide = 13;
	public const short CRC = 14;
	public const short LocalClientAuthority = 15;
}

Most of these messages are for internal use only. Users should not define message ids in this range.