Hi there,
I’m trying to tell my clients to switch scene from the server using the ServerChangeScene command. When I call the function, the server switch the scene correctly but nothing happens on clients. I search a lot but don’t found a solution.
I dont want to use autoswitch using the NetworkManager inspector. I want to control it from code.
Here is my simple code, when player is on main menu, and want to switch to forest scene when 2 clients are connected:
class NetworkManagerCustom : NetworkManager
{
...
public override void OnServerConnect(NetworkConnection conn)
{
if (NetworkServer.connections.Count < 2)
{
print("[Server] Match created. Waiting for opponent.");
connText.text = "Match created. Waiting for opponent.";
}
else
{
print("[Server] Opponent connected. Starting match.");
connText.text = "Opponent connected. Starting match.";
ServerChangeScene("forest");
}
}
...
}
It just check for two connections (server player and client player) and call ServerChangeScene.
As I said, when server player and client player connects, server player switch to forest scene, but client player remains on main menu.
What im doing wrong? What should I do?