How to load online level

Hello

I’m working on a multiplayer game and what i’d like to know is how to get the index level of the level that being created by the server, I have a player that creates the game and host it, for that he must choose a level to load, but when another player wants to login to the game, the level does not load.

Here’s the part when a player create a game

if ( GUI.Button(ResizeGUI(new Rect(1000.0f,400f,400.0f,60.0f)), "Lunch Server", ButtonStyle))
            {
            int displayLevel=selectedLevel+1;
            Application.LoadLevel(selectedLevel);
            Network.InitializeSecurity();
            Network.InitializeServer(int.Parse("1"), int.Parse(port), !Network.HavePublicAddress());
            MasterServer.RegisterHost (gameName, serverName+"( Level "+displayLevel+" )");
            Debug.Log(MasterServer.ipAddress);
}

here’s when a player join a game

foreach(HostData c in data)
            {
               Debug.Log(c.ip);
               GUILayout.BeginArea(ResizeGUI(new Rect (700, 400, 400, 400)),LabelStyle);
               GUILayout.BeginHorizontal ();
               GUILayout.Box (c.gameName);
               if(GUILayout.Button("Join"))
               {
                  Network.Connect (c);
                  
                  Debug.Log("adresse ip"+c.ip);
                  Debug.Log("adresse use nat"+c.useNat);
            
               }
               GUILayout.EndHorizontal ();
               GUILayout.EndArea();
            }

Does anyone know how I can retrieve the index level once the server is created or any other solution to remedy to this?

Thank you

It’s a networked game, so the client can connect to the server and ask to be told the current level/scene. You could, for example, have the client make an RPC requesting the server make an RPC call to it and tells it what the scene is. Or use NetworkViews to synchronise the scene state.

Thank you for your snswer i fixed it by sending rpc call that is synchronised with all the player

[RPC]
	void LoadLevelOn(int selectedLevel)
	{
		Application.LoadLevel(selectedLevel);
	}