Find other players object

Hi all,

I’m all new to UNET, and it’s a mess for doing a very simple thing …

I’m building a very simple multiplayer turn-based game, with authoritative dedicated server.

Starting the server and spawning the players is fine.

When the latest player enters the server, I want the server to tell every players which players starts first.

If the server says “player 1 is playing”, how can player 2 get access to player1’s object ( to retrieve its player name, for example ) ?

Thanks for help !
Vincent.

[SyncVar] should be enough, all player objects will be synced across the network.

One way could be to keep a list of all players on your NetworkManager by overriding OnServerAddPlayer(), and reference the NetworkManager object from a [Command] server-side method on the player object, which passes the names in a ClientRpc back to all the clients. A cleaner way would probably involve Messages. http://docs.unity3d.com/Manual/UNetMessages.html