在从 MasterServer 报告事件时,在客户端或服务器上调用。
例如在收到主机列表或主机注册成功时。
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Start() {
Network.InitializeServer(32, 25000);
}
void OnServerInitialized() {
MasterServer.RegisterHost("MyGameVer1.0.0_42", "My Game Instance", "This is a comment and place to store data");
}
void OnMasterServerEvent(MasterServerEvent msEvent) {
if (msEvent == MasterServerEvent.RegistrationSucceeded)
Debug.Log("Server registered");
}
}