Unet Online Scene Selector, Choose from multiple maps, etc.

All I want is a way to choose what online level will be loaded. Maybe make it something players in a lobby can vote for, eventually.

I’ve spent enough time searching to assume that NetworkManager.ServerChangeScene is the answer, but I don’t know how it’s implemented. The advice I found is written for other knowledgeable programmers, which I am not. Nor are those asking, usually. Still, couldn’t hurt to try for myself.

If you could even just direct me to an example where this has been made to work, or tell me what to type where, I can figure out the rest. Please help. Thank you.

Hello @jinnindo,

When you set your online/offline scene in NetworkManager, a method NetworkManager.ServerChangeScene is called automatically in the background. When this method is called, the NetworkManager.OnServerSceneChanged is called on the server and NetworkManager.OnClientSceneChanged is called on the clients. These methods can be overridden and customized. If you are using the networkmanager, you can get the instance of your networkmanager by writing NetworkManager.singleton.

So at the point where you would like to globally change your scene (server & clients), you should have something like:

void ChangeScene(string sceneName){
    // Change scene on the server

In addition, according to the documentation you need to set clients to be ready again after changing the scene, so for example you could override the NetworkManager’s method:

public override void OnClientSceneChanged(NetworkConnection conn){
    // Set client as ready

See following links for more information:




A TOTALLY DIFFERENT MAYBE BETTER WAY! if anyone cares hahah =)

you can create Multiple Lobbys as Scenes with seperate instances of Lobby manager with play scene set to some different scene … then when you Host add a prefix onto match.name ie…

manager.matchName = "F_" + roomNameField.text ; // An InputField.text

Then when you check for rooms available, you can then only display rooms available to join that have the prefix at beginning ie.

foreach (var match in manager.matches)
		string checkMatchName = match.name;
		if (checkMatchName.StartsWith("F"))
	if (GUI.Button(new Rect(xpos, ypos, 200, 40), "Join " + match.name))
			manager.matchName = match.name;
			manager.matchSize = (uint)match.currentSize;
	manager.matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, manager.OnMatchJoined);
			ypos += spacing;

Thus only Displaying Rooms with the PreFix “F” available to join, so use different PreFixes for different lobbies and Clients can then only connect to Matches in the required lobby =)