- Home /
UNET Players not spawning on server change scene
I am using NetworkStarter sample project to make a lobby: http://forum.unity3d.com/threads/unet-sample-projects.331978/
The problem i have is when i change scene the player prefab does now spawn. The first time it enters to the game it does spawn, if you win the level and continue, in the next level it doesn't spawn.
I have somethink like: NetworkManager.singleton.ServerChangeScene("02.Game");
I already have done this with a game of mine, but here i can't find what's happening. In the level i have game object with network start position.
The weird thing is that is the same level, the flow is: Menu (lobby) -> game (level1) ->game (level1) the first time in the game it does spawn the player, but when i change scene it doesn't any more.
thank u in advance!
Did you ever figure this out? I have the same issue.
Answer by sglindme · Jun 28, 2016 at 08:09 PM
Did you ever figure this out? One thing I'm noticing is that the port on the server network manager seems to just go back to the default value(7777) whenever it changes scene. This could be a cause of the problem....
I think i did! When i rebuilt the lobbyscene for my project from scratch in a simpler way the same problem occured and after some more research i realized that some important events would not get called on a levelchange. This post helped me out **http://forum.unity3d.com/threads/lobbyplayer-to-gameplayer-networklobbymanager.349614/**
You need to make sure that your lobbyplayer-objects are kept in the scene... i did this by parenting them on the lobbymanager which doesn't get destroyed On Load... hope this helps.
So just to get this straight what you did in the player prefab in the Awake() or Start() is to set the Lobby$$anonymous$$anager as the parent of the player prefab?
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Player Prefab on Lobby Managers? 5 Answers
Netcode [Command] Issues .. no errors, just not working. 1 Answer
How to check when a new client/local player is loaded? 1 Answer
Networking HLAPI Spawning Objects 2 Answers