public void StartNetworkHost() { host = gameObject.AddComponent <NetworkHost>(); NetworkSync sync = gameObject.AddComponent <NetworkSync>(); sync.Initialize(0, "GameController"); host.Initialize(); matchmakingHost = GetComponent <MatchmakingHost>() ?? gameObject.AddComponent <MatchmakingHost>(); }
public void CleanupNetwork() { if (IsHost) { Destroy(host); host = null; Destroy(matchmakingHost); matchmakingHost = null; } else { Destroy(client); client = null; Destroy(matchmakingClient); matchmakingClient = null; } Destroy(GetComponent <NetworkSync>()); IsHost = false; }