public void OnSetUpID(NetworkMessage netMsg) { SetIDMessage msg = netMsg.ReadMessage <SetIDMessage>(); if (clientID < 0) { clientID = msg.id; } }
void OnServerConnect(NetworkMessage netMsg) { Debug.Log(string.Format("Client has connected to server with connection id: {0}", netMsg.conn.connectionId)); NetworkServer.SetClientReady(netMsg.conn); SetIDMessage msg = new SetIDMessage(); msg.id = netMsg.conn.connectionId; clients.Add(msg.id); NetworkServer.SendToClient(netMsg.conn.connectionId, (short)MyMsgType.ClientSetupID, msg); }