Browse Source

Added Steamworks callback to update

James Peret 2 years ago
parent
commit
64854a738e
3 changed files with 22 additions and 9 deletions
  1. 5 1
      Readme.md
  2. 16 7
      Runtime/SteamworksManager.cs
  3. 1 1
      package.json

+ 5 - 1
Readme.md

@@ -1,4 +1,4 @@
-# 📦 KairoEngine.SteamIntegration.v0.2.11
+# 📦 KairoEngine.SteamIntegration.v0.2.12
 
 Kairoengine Steam Integration library.
 
@@ -14,6 +14,10 @@ Kairoengine Steam Integration library.
 
 ### 📄Changelog
 
+##### v0.2.12
+- Added Steamworks callback to Update
+- Added Steamworks shutdown on aplication quit, destroy and disable
+
 ##### v0.2.11
 - Fixed Steam achievement sync with game achievements system
 

+ 16 - 7
Runtime/SteamworksManager.cs

@@ -24,13 +24,9 @@ namespace KairoEngine.SteamIntegration
         public static bool hasInitialized = false;
         private string playerName;
 
-        private void OnDestroy() 
-        {
-            stats.Stop();
-            achievements.Stop();
-            Steamworks.SteamClient.Shutdown();
-            hasInitialized = false;
-        }
+        private void OnDestroy() => StopSteamworks();
+        private void OnApplicationQuit() => StopSteamworks();
+        private void OnDisable() => StopSteamworks();
         
 
         private void Start()
@@ -60,6 +56,19 @@ namespace KairoEngine.SteamIntegration
             }
         }
 
+        void Update()
+        {
+            Steamworks.SteamClient.RunCallbacks();
+        }
+
+        public void StopSteamworks()
+        {
+            stats.Stop();
+            achievements.Stop();
+            Steamworks.SteamClient.Shutdown();
+            hasInitialized = false;
+        }
+
         public static bool HasInitialized()
         {
             if(hasInitialized == false)

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
     "name": "at.kairoscope.kairoengine.steam-integration",
     "displayName": "KairoEngine Steam Integration",
-    "version": "0.2.11",
+    "version": "0.2.12",
     "unity": "2020.3",
     "description": "KairoEngine module for integrating Steamworks services",
     "dependencies": {