public void StartServer(int port, PeerDebug.Settings debugSettings = null) { StatefulWorld.Instance.Initialize(); PeerDebug debug = null; if (debugSettings != null) { debug = gameObject.AddComponent <PeerDebug>(); debug.Initialize(debugSettings); } server = new Peer(debug); server.Listen(port); }
public void ConnectClient(string address, int port, PeerDebug.Settings debugSettings = null) { if (server == null) { StatefulWorld.Instance.Initialize(); } PeerDebug debug = null; if (debugSettings != null && server == null) { debug = gameObject.AddComponent <PeerDebug>(); debug.Initialize(debugSettings); } client = new Peer(debug); client.Connect(address, port, server != null); if (server != null) { server.HasListenClient = true; } }