NetworkSetup
public enum MenuScreen
{
mainMenu, gamesList, manualConnect, hostGames, hostingMasterServer, networkSettings, connecting
}
public class NetworkSetup : MonoBehaviour
{
public InputField yourPort, hostPort, hostIP, gameNameInput, MShostPort, MShostIP, playerNameInput;
public Text status;
public Toggle serverCanPlayToggle;
//public Button startGameButton;
public GameObject gameServerListContentGameObject;
public GameObject gameServerJoinButtonPrefab;
public GameObject mainMenuScreen, gamesListScreen, manualConnectScreen, hostGamesScreen, hostingMasterServerScreen, networkSettingsScreen, connectingScreen, tileScreen;
//...
This class is currently being used in the main menu. It shows how all the network stuff can be started up, whether its a Server hosting a game or a Client joining one or even a Master Server getting ready to host Server listings, its all here.
This class should be used as an example. Likely your UI/screen flow will be more unique to your game, so its recommended to copy and adapt pockets of code from here to fit your games setup.
I wont run through the Methods on this class, but I recommend you read through and work out how to set up various things.