public void SetupNetwork() { Assert.IsNotNull(NetworkManager.singleton.playerPrefab); NetworkManager.singleton.customConfig = true; NetworkManager.singleton.networkAddress = _ip; NetworkManager.singleton.networkPort = _port; NetworkManager.singleton.autoCreatePlayer = false; networkMigrManager = NetworkManager.singleton.gameObject.AddComponent <NetworkMigrationManager>(); Assert.IsTrue(NetworkManager.singleton.StartServer(), "Server was not started!"); NetworkManager.singleton.SetupMigrationManager(networkMigrManager); client = NetworkManager.singleton.StartClient(); client.Connect(_ip, _port); Assert.IsNull(client.connection, "Client is not connected"); networkMigrManager.Initialize(client, NetworkManager.singleton.matchInfo); networkMigrManager.SendPeerInfo(); }
public void SetupNetwork() { netManagerObj = new GameObject(); networkManager = netManagerObj.AddComponent <NetworkManager>(); networkManager.playerPrefab = Resources.Load("PlayerGameObject", typeof(GameObject)) as GameObject; Assert.IsNotNull(networkManager.playerPrefab); networkManager.customConfig = true; networkManager.networkAddress = _ip; networkManager.networkPort = _port; networkManager.autoCreatePlayer = false; networkMigrManager = netManagerObj.AddComponent <NetworkMigrationManager>(); Assert.IsTrue(networkManager.StartServer(), "Server was not started!"); networkManager.SetupMigrationManager(networkMigrManager); client = networkManager.StartClient(); client.Connect(_ip, _port); Assert.IsNull(client.connection, "Client is not connected"); networkMigrManager.Initialize(client, networkManager.matchInfo); networkMigrManager.SendPeerInfo(); }