- Home /
How to assign players a number during muliplayer
Hi Guys. I've looked for this answer but can't find it - sorry if this is a duplicate. I'm OK at coding, and my one player version of my game works really well, but I'm branching out to make it multiplayer, and it's my first time doing networking and I'm struggling.
I've made my player prefab (basically a camera with a few scripts attached. There will only ever be a player 1 and 2 in the game.
What I want to happen is when the player prefabs are instantiated, one should be called "p1" and the other "p2". That's all.
I've tried
if (Network.isServer) {}
in the Start, but for some reason both Client and Server versions of my game (one built, the other in Unity) return as Clients.
I tried using a [SyncVar] bool in the Start class, hoping the host would make it true, which would be seen by the client to know to be p2, but I can't get it to work.
Does anyone please know a quick and easy way to name both Network Managed clones differently?
Thanks in advance
Ian