Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Multiplayer (Mirror)
  4. Network Lobby Manager UI

Network Lobby Manager UI

Since the default UI components from Mirror will not be used, the NetworkLobbyManagerUI_Mirror component from the integration package will be used to manage UI elements in the multiplayer menu.

The multiplayer menu can broken down into three main sub-menus:

  1. Main MP Menu: When the multiplayer menu scene starts, this is the first menu that the player sees. This where the player can host/join a game.
  2. Loading Menu: When starting/joining a room, the lobby menu will be temporarily shown to the player.
  3. Lobby Menu/Map Menu: When the player is inside a lobby, this menu is activated.

NetworkLobbyManager_UI fields:

  1. General:
    1. Main Menu Scene: Drag and drop the main menu’s scene into this field.
    2. Main Canvas: The main canvas object is the parent canvas object that includes all the UI objects of the multiplayer menu. All of the UI objects discussed in this documentation page are children objects of the main canvas.
    3. Game Version Text: A UI Text object that will display the player’s game version. The game version can be set from the NetworkLobbyManager_Mirror component.
  2. Main MP Menu:
    1. Main MP Menu: The main multiplayer menu is a game object which includes UI objects visible to the player when he first opens the multiplayer menu scene or when he leaves a lobby.
    2. Address Input Field: A UI Input Field, child of the main MP menu, in which the player can pick the network address from/to which a game can be hosted/joined. In the “On End Edit” event of the Input Field component, drag and drop the object that includes the “NetworkLobbyManagerUI_Mirror” as the event source and set the event to NetworkLobbyManagerUI_Mirror-> “OnAddressInputValueChanged”. The default network address can be chosen from the NetworkLobbyManager_Mirror component. If you don’t want to allow the player to change the network address then leave this field unassigned.
    3. Port Input Field: A UI Input Field, child of the main MP menu, in which the player can pick the port from/to which a game can be hosted/joined. In the “On End Edit” event of the Input Field component, drag and drop the object that includes the “NetworkLobbyManagerUI²_Mirror” as the event source and set the event to NetworkLobbyManagerUI_Mirror-> “OnPortInputValueChanged”. The default network port can be chosen from the Telepathy Transport component. If you don’t want to allow the player to change the network port then leave this field unassigned.
    4. Start Host Button: Child of the main MP menu object, this UI button allows the player to start hosting a new lobby using the inputted network address and port. In the “On Click” event of the Button component, drag and drop the object that includes the “NetworkLobbyManagerUI_Mirror” as the event source and set the event to NetworkLobbyManagerUI_Mirror-> “StartHost”.
    5. Start Client Button: Child of the main MP menu object, this UI button allows the player to join an existing lobby using the inputted network address and port. In the “On Click” event of the Button component, drag and drop the object that includes the “NetworkLobbyManagerUI_Mirror” as the event source and set the event to NetworkLobbyManagerUI_Mirror-> “StartClient”.
  3. Loading Menu: 
    1. Loading Menu: When the player transitions between a menu to another, the loading menu is briefly shown.
    2. Info Message Text: A UI Text object that shows a message to the player when there’s an error/warning (for example, when the connection to a room is lost, player will be moved back to the main MP menu and a the Info Message Text will inform the player that the connection to the room was lost). Make sure that this UI Text object is a direct child of the main canvas so that it can be shown in all sub-menus.
    3. Info Message Reload: How long (in seconds) will each info message will be shown for?
  4. Lobby Menu: 
    1. Lobby Menu: The sub-menu object that is activated when the player is an active room/lobby. This where the faction info of other players and map info are shown.
    2. Lobby Name: A UI Text, child of the lobby menu, which displays the name of the lobby that the player is in.
    3. Player Lobby Objects Parent: UI object, parent of all Network Lobby Faction objects and child of the lobby menu. Each child object represents a faction slot. In order to organize the faction slots and display them correctly, it’s recommended to have a Grid Layout Group component attached to this object.
  5. Map Menu:
    1. Map Menu: Like the lobby menu, this is also active only if the player is in a room/lobby. This menu displays the available maps in the room. Only the host is able to change the map for the lobby.
    2. Map Drop Down Menu: A UI Dropdown object, child of the map sub-menu, that allows the host to pick a map from a list of possible options. In the “On Value Changed” event of the Dropdown component, drag and drop the object that includes the “NetworkLobbyManagerUI_Mirror” as the event source and set the event to NetworkLobbyManagerUI_Mirror-> “OnMapChanged”.
    3. Map Initial Population Text: A UI Text object, child of the map sub-menu, used to display the selected map’s initial amount of population slots.
    4. Map Description Text: A UI Text object, child of the map sub-menu, that shows the selected map’s description.
    5. Map Max Factions Text: A UI Text object, child of the map sub-menu, that shows the selected map’s maximum allowed amount of factions. This is also the maximum allowed connections for the lobby.
    6. Defeat Condition Menu: Allows to define defeat conditions that can only be chosen by the host in the lobby menu to be used in the target map.
      1. Menu: A UI Dropdown that allows the player to pick a defeat conditions from a list of possible options.
      2. Defeat Condition UI Elements: Each element of this array represents an option in the above drop down menu. For each element, assign the defeat condition in the Condition field and the corresponding name that will appear as the actual option in the above drop down menu in the Name field.
    7. Speed Modifier Menu: Allows to define different options of speed modifiers so that only the host in the lobby menu can choose one of them in the single player menu to use in the target map.
      1. Menu: A UI Dropdown that allows the player to pick the speed modifier from a list of possible options.
      2. Speed Modifier UI Elements: Each element of this array represents an option in the above drop down menu. For each element, assign the value of the speed modifier under the Speed Modifier field and the associated name of the modifier that will appear as an option in the drop down menu in the Name field.
    8. Start Game Button: A UI Button object, child of the map sub-menu, that is only shown for the host player. This button allows the host to start game as long as all players are ready. In the “On Click” event of the Button component, drag and drop the object that includes the “NetworkLobbyManagerUI_Mirror” as the event source and set the event to NetworkLobbyManagerUI_Mirror-> “Start Game”.
  6. Other UI elements:
    1. Back Button: A UI Button object, direct child of the main canvas object, that takes the player back to the last menu he was in. In the “On Click” event of the Button component, drag and drop the object that includes the “NetworkLobbyManagerUI_Mirror” as the event source and set the event to NetworkLobbyManagerUI_Mirror-> “Back”. When the player is in the main MP menu, then the back button will take the player back to the main menu scene.

How can we help?