void Start () { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; networkManager = FindObjectOfType<CustomNetworkManager>(); // This allows us to send as much data as possible. However this means that connection to server will be slow if the servers keeps track of a lot of objects networkManager.connectionConfig.MaxSentMessageQueueSize = ushort.MaxValue; networkManager.Start(); ActivateInputField(); // Use the matchmaker if (useMatchmaking) { networkManager.StartMatchMaker(); networkManager.matchMaker.SetProgramAppID((AppID)359252); if (hostMatchmakingGame) networkManager.matchMaker.CreateMatch("Default", 100, false, "", networkManager.OnMatchCreate); else networkManager.matchMaker.ListMatches(0, 6, "", OnMatchList); } if (autoConnect) { if (serverInEditor) { if (Application.isEditor) ConnectAs(ConnectionType.Host); else ConnectAs(ConnectionType.Client); } else { if (Application.isEditor) ConnectAs(ConnectionType.Client); else ConnectAs(ConnectionType.Host); } } }