public override void OnStartServer() { NetworkMessenger.AddListener <HexUpdateMessage>(OnHexUpdated); //Load persistant data here. hexGridDimensions = new HexGridDimensions { Width = 12, Height = 12 }; for (var z = 0; z < hexGridDimensions.Height; z++) { for (var x = 0; x < hexGridDimensions.Width; x++) { CreateCell(x, z); } } }
//A client has connected to the server. public override void OnServerConnect(NetworkConnection conn) { //Possible issue where this is called twice :( https://issuetracker.unity3d.com/issues/onserverconnect-function-is-called-twice Debug.Log(string.Format("A client has connected to the server with id: {0}, host id: {1}", conn.connectionId, conn.hostId)); NetworkMessenger.AddListener <TestMessage>(Handler); }
public override void OnStartServer() { NetworkMessenger.AddListener <ChatInputMessage>(chatMsg => ChatLog.Add(chatMsg.ChatLine)); }