public void Setup() { // start server/client NetworkServer.Listen(1); NetworkClient.ConnectHost(); NetworkServer.SpawnObjects(); NetworkServer.ActivateHostScene(); NetworkClient.ConnectLocalServer(); NetworkServer.localConnection.isAuthenticated = true; NetworkClient.connection.isAuthenticated = true; NetworkClient.Ready(); }
public IEnumerator UnitySetUp() { Transport.activeTransport = new GameObject().AddComponent <MemoryTransport>(); // start server and wait 1 frame NetworkServer.Listen(1); yield return(null); // connection host and wait 1 frame NetworkClient.ConnectHost(); NetworkClient.ConnectLocalServer(); yield return(null); }
// fully connect HOST client to local server // sets NetworkServer.localConnection / NetworkClient.connection. protected void ConnectHostClientBlocking() { NetworkClient.ConnectHost(); NetworkClient.ConnectLocalServer(); UpdateTransport(); Assert.That(NetworkServer.connections.Count, Is.EqualTo(1)); // set isSpawnFinished flag. // so that any Spawn() calls will call OnStartClient and set isClient=true // for the client objects. // otherwise this would only happen after AddPlayerForConnection. // but not all tests have a player. NetworkClient.isSpawnFinished = true; }
public void Setup() { Transport.activeTransport = new GameObject().AddComponent <MemoryTransport>(); // start server/client NetworkServer.Listen(1); NetworkClient.ConnectHost(); NetworkServer.SpawnObjects(); NetworkServer.ActivateHostScene(); NetworkClient.ConnectLocalServer(); NetworkServer.localConnection.isAuthenticated = true; NetworkClient.connection.isAuthenticated = true; ClientScene.Ready(NetworkClient.connection); }
/// <summary> /// connect host mode /// </summary> public void ConnectLocalServer() { NetworkClient.ConnectLocalServer(); }