Managing Multiple Scenes and Player Prefabs

I’m hoping someone out there could shed some light on managing multiple scenes with the network manager. Basically I have a 2D top down space shooter game where you can land on the planets below and explore. So I eventually got the Network Manager working for the main galaxy scene, but I want to use a different prefab for the player when they land on planets. I’m using the feature to automatically spawn my ship prefab, but I want a different player prefab spawned on the planet scenes instead. I’m just wondering if I can somehow manage all of the scenes and prefabs from one Network Manager so that players can either explore together in the same scene or go their separate ways to different scenes (planets). Can anyone give me a general idea of how that would be accomplished? I suppose I need to stop using the automatic spawn feature and spawn everything in code to accommodate multiple player prefabs, but I’m still not sure how to manage multiple scenes (spawn a ship prefab on Scene A while spawning a player prefab on Scene B) with one network manager, or if its even possible.

Hi BrandonChurch,

I’m still VERY new to Unity (especially Unet and networking) but allow me to welcome you to Unity and the forums - I hope you enjoy your time here.

I found this link:
http://docs.unity3d.com/ScriptReference/Networking.NetworkManager.ServerChangeScene.html

That SHOULD hopefully help you with the different scenes issue (I’m logging it away for myself later :wink: )

As for the prefabs… give me a few more mins…

Okay, I’ve not had a proper read through (tired and need some sleep, lol)… but this might be what you’re looking for. It shows you that you can create a custom network manager (addon?) and then call OnServerAddPlayer from there, which will allow you to make a different player prefab… I think…

http://docs.unity3d.com/Manual/UNetPlayers.html

Thanks for the reply Tsyung, the second link helps a lot with managing player prefabs. I must have read through the manual too fast. Unfortunately, I think the NetworkManager.ServerChangeScene changes the scene for all clients. I’d like to somehow have clients in different scenes while still connected to the host. Do you think I would just change the scene locally instead of using a network command?

I guess that Application.LoadLevel would work (sent via RPC). And have a communication script with DontDestroyOnLoad(this); running on that comms script so that you can still send stuff back and forth…

Or just send it via the player lol.