- Home /
Spawning two duplicate players in Unity Game
Synopsis: whenever I build and run the game in the player while playing in the application, the game creates duplicate prefab character controllers. Despite that my spawn function is only called once, it creates multiple characters. Does anyone know what could trigger this?
The Details: I have an fps network game that I'm testing on unity's server. Whenever I test the network on my computer using the application's play feature and by playing a built(mac standalone) version of the game itself, I create duplicate character controllers. I've determined that all the character controllers are the same by attaching a random number value to the name of the character controller in my spawn function. My spawn function is triggered by making a connection to the server, or initializing it.
My project can be seen in guthub: here
Answer by ShadowAngel · Dec 01, 2012 at 01:42 PM
You have 2 spawn player actions. One in OnConnectedToServer() and other OnServerInitialized(). If i remember correct client - server theory, EVERY player will connect to server including player thet created a server. So you call your spawn 2 times. 1) When server started. 2) When first player connected. Check there. I dont got any exp with unity network engien to tell you more.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
UNET server -batchmode -nographics 1 Answer
Networking Player Nametag 1 Answer
Best cross platform Http Library? 1 Answer
Console Application 0 Answers