Closed Flawake closed 2 months ago
Not a bug...you're not doing it correctly. networkSceneName
is only changed when full scene changes are done through Mirror, e.g. NetworkManager.singleton.ServerChangeScene
. Additive loading / unloading in your own code via Scene Manager doesn't change that.
Additionally, you don't do MoveGameObjectToScene on the client...only on server. On clients, players and spawned objects stay in the main container scene, not in the additive scenes.
For additional support, please join our Discord.
I dont know if this is a bug or desired behaviour, but I beleive this is a bug. When additive loading scene B and then async unloading scene A the networkSceneName is still scene A which was unloaded.
Change the scene for a player by loading the scene additive: (Code on server)
Move the player object on the server: (Code on server)
SceneManager.MoveGameObjectToScene(conn.identity.gameObject, SceneManager.GetSceneByName(data.requestedScene));
Move the player on the client to the other scene and unload the original scene: (Code on client)
networkSceneName is still sceneA altough it is unloaded
Expected behavior I expected networkSceneName to change to SceneB
Windows11 Unity version: 2022.3.21f1 Mirror version: 89.0.0
The code for setting the networkSceneName is in: https://github.com/MirrorNetworking/Mirror/blob/master/Assets/Mirror/Core/NetworkManager.cs line
As you can see it does change networkSceneName when not loading the scene additive
Or should I just set networkSceneName manually after unloading the old scene?