void Setup() { Networking.PrimarySocket.playerConnected += (NetworkingPlayer player) => { networkingManager.OnClientConnected(player); }; Networking.ClientReady(Networking.PrimarySocket); }
protected override void NetworkStart() { base.NetworkStart(); if (OwningNetWorker.IsServer) // Fired whenever a client says that they are ready on the network { OwningNetWorker.clientReady += (player) => { Debug.Log("The player with id " + player.NetworkId + " is ready to go!"); } } ; else // Tell the server that we are ready on the network, this can be called at any time { Networking.ClientReady(OwningNetWorker); } enteredProximity += (mine, other) => { Debug.Log(other.name + " entered my (" + mine.name + ") proximity"); }; exitedProximity += (mine, other) => { Debug.Log(other.name + " left my (" + mine.name + ") proximity"); }; }
protected override void NetworkStart() { base.NetworkStart(); if (OwningNetWorker.IsServer) // Fired whenever a client says that they are ready on the Network { OwningNetWorker.clientReady += (player) => { Debug.Log("The player with id " + player.NetworkId + " is ready to go!"); } } ; else // Tell the server that we are ready on the Network, this can be called at any time { Networking.ClientReady(OwningNetWorker); } enteredProximity += (mine, other) => { Debug.Log(other.name + " entered my (" + mine.name + ") proximity"); }; exitedProximity += (mine, other) => { Debug.Log(other.name + " left my (" + mine.name + ") proximity"); }; if (IsOwner) { //Only allow the owner to register this event Networking.PrimarySocket.AddCustomDataReadEvent(SERVER_ONLY, ReadFromNetwork); } }