Network server spawns both players as client or server,Players in network game both spawn as client or server
I am working on a multiplayer game using UNET. Every time i host a match by playing the game in the editor, every player that joins is considered as server. If i host a match by using a built game (not using the editor) every palyer that joins is considered a client; because of this, every time that my enemy spawner tries to instantiate an enemy prefab with the command "NetworkServer.Spawn(enemy);" i get this error message: "SpawnObject for EnemyUpRight(Clone) (UnityEngine.GameObject), NetworkServer is not active. Cannot spawn objects without an active server."
To check if a player is a client or a server, i wrote this code in the player setup script: "if (isServer) Debug.Log("server"); else Debug.Log("Client");"
I really can't understand what's going on.
,I am creating a multiplayer game using UNET, if i host a game using the unity editor, every player that connects to the game is considered as server. I know this because in the player setup script i wrote: void Start() { if (isServer) Debug.Log("server"); else Debug.Log("Client"); }
The problem is that if i host a game with the build (not with the unity editor) every player is considered a client and they all spawn in the same network spawn position. Also, an error message appears saying "SpawnObject for EnemyUpRight(Clone) (UnityEngine.GameObject), NetworkServer is not active. Cannot spawn objects without an active server" This happens when the enemy spawner tries instantiating an enemy prefab with "NetworkServer.Spawn(enemy);"
Answer by Ardoriccardo · Jul 11, 2019 at 10:48 AM
I don't know why, but the text is repeating twice, i think i messed up something.
Your answer
Follow this Question
Related Questions
NetworkStartPosition rotation problem 0 Answers
Best Network Manager Settings For Very Intensive Network ? 0 Answers
i just can't seem to figure out how to make a voting system, using SyncVar hooks and commands 0 Answers
Unet [Command] not working? 0 Answers
Is playerPrefab in NetworkLobbyManager used for anything at all? 0 Answers