How to correctly change scene with a Lobby Manager?
I'm making a game with 3 scenes: offline scene and online scene given directly to the lobby manager to handle, and a third scene with only 1 game object (DungeonManager) that spawn the dungeon procedurally. When the players are in the online scene they can access a menu from which the can choose to change scene (for simplicity right now any player can do so). The UI handler function activated when the player clicks the button invokes a function on an object (called sceneChanger) that does only one thing, changing the scene (big surprise). When the host is in unity (and not on the standalone) it works, when the host is on the standalone, on the unity instance I see it tries to spawn twice the DungeonManager, the second time gives error with all the procedural content, saying the Network Server is not active.
Here is the code of the UI handler:
public void goToDungeon()
{
if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("Capital Central Square")) //if I'm still in the first online scene
{
handleChange();
}
}
public void handleChange()
{
sceneHandler.GetComponent<changeScene>().changeIt = true;
sceneHandler.GetComponent<changeScene>().sceneChange();
}
While the sceneChanger script is this:
public void sceneChange () {
if (changeIt)
{
lobbist.gameObject.GetComponent<NetworkLobbyManager>().ServerChangeScene("Room example");
}
}
Why is that? How can i solve this problem? Any help will be greatly appreciated.
Your answer
Follow this Question
Related Questions
How can I make a simple Lobby scene, while staying in the same scene all the time? 0 Answers
UNET StopServer() without reloading lobby scene 2 Answers
Raycast doesnt work for client in netcode 0 Answers
Client's object spawn position and rotation network bug? 0 Answers
Networking - Host can spawn objects but client cant 0 Answers