public void Close() { if (client != null) { client.Dispose(); } }
void OnDisable() { if (steamClient != null) { steamClient.Dispose(); steamClient = null; } }
private void OnDestroy() { if (client != null) { client.Dispose(); client = null; } }
private void OnDestroy() { // disposes the steamclient when the steammanager/steamclient-script is destroyed if (client != null) { Client.Instance.Auth.GetAuthSessionTicket().Cancel(); client.Dispose(); client = null; } }
void OnEnable() { steamClient = new Facepunch.Steamworks.Client(220); // 220 = half-life 2 appid if (!steamClient.IsValid) { steamClient.Dispose(); throw new System.Exception("Couldn't init Steam - is Steam running? Do you own Half-Life 2? Is steam_appid.txt in your project folder?"); } Debug.Log("Hello " + steamClient.Username); Debug.Log("Your SteamID is " + steamClient.SteamId); }
void Update() { if (Input.GetKeyDown(KeyCode.R)) { Debug.Log("Disposing"); client.Dispose(); } if (client == null) { return; } try { //UnityEngine.Profiling.Profiler.BeginSample("Steam Update"); client.Update(); } finally { //UnityEngine.Profiling.Profiler.EndSample(); } }
private void OnDestroy() { if (client != null) { //should we try to close any open connections? //client.Networking.CloseSession() //any clients should time out when closed...once we have keep-alive packets up and running if (NetworkManager.instance != null) { NetworkManager.instance.CloseConnectionsOnDestroy(); } client.Dispose(); client = null; } }