I'm trying to switch a scene over the network and i want each player to locally load the scene Async so that everyone can get a loading screen. I'm struggling with Command and RPC calls. After the scene changes i would like to respawn a new player and associate it with the client.
public void changeLevel(string name)
{
CmdChangeLevel(name);
//nm.ServerChangeScene(name); -> This doesnt change the scene Async
}
void changeScene(string name)
{
SceneManager.LoadScene(name);
//Stuff to re-Instantiate the player
}
[Command]
void CmdChangeLevel(string name)
{
SceneManager.LoadScene(name);
RpcChangeLevel(name);
}
[ClientRpc]
void RpcChangeLevel(string name)
{
changeScene(name);
}
Everything i tried resulted in a scene switch but no players instantiated, like (nm = networkManager) nm.OnServerAddPlayer() and instantiate it then spawn it through the server. Help would be much appreciated, thanks in advance