- Home /
Check when a player finished spawning [Netcode For GameObjects!]
I want something to happen when all player prefabs have spawned (remove the UI for everyone at the same time and also edit the players)
Is there an event or anything that I can check through the network manager when all players have finished spawning?
Answer by yonatanab1 · Mar 11 at 11:27 PM
Great answer, I did start with checking every few seconds until I was informed:
apperently there is a function "onPlayerSpawn". we can override it and start all functions we need.
I would also like to ask if anyone knows what is the correct way to spawn a PLAYER Prefab. (so the Network Manager Knows It's a Networked Player Prefab but not in the first scene of the game that loads).
You could use ClientScene.AddPlayer to manually spawn a player on the client-side and this is going to call the NetworkServer.AddPlayerForConnection function on your server. This will make the NetworkManager spawn the player prefab.
Answer by VanToRiaXVII · Mar 10 at 04:12 PM
The short answer is no. You will have to create a loop that goes through all the different player prefabs to make sure they have spawned. One way to do it would be to check every few seconds if all the prefabs exist in the scene.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Remove players and close server in Unity Multiplayer Game 0 Answers
Player ReSpawn Logic 1 Answer
Setup Custom Multiplayer Joining 0 Answers
Why are objects only spawning on host but not on remote clients? 3 Answers