Hi All,
Hoping someone can help with this scenario. I have created my own NetServer & NetClient scripts so that I do not have to use the NetworkManager provided by Unet.
All is going well - NetServer works & NetClient works and then I want to combine them to create a Host (Server + Client). The problem I face is that when I run the Host it generates a server player and a client player on the local machine simultaneously when I only need one Player object.
The spawn code resides in NetServer in the OnAddPlayer Callback:
var playerGo = Instantiate<GameObject>(globals.playerKnightPrefab);
NetworkServer.AddPlayerForConnection(netMsg.conn, playerGo, 0);
From what I have read in the Unity Docs the NetworkServer.AddPlayerForConnection call will create a synced object on the clients (does not require NetworkServer.Spawn). What I need is a way to specify that this is a HOST scenario and that only one object is needed for the local machine.
Can anyone point me in the right direction to stop the double spawn (Server spawns object and then Client spawn the same object)?
Thanks in advance.