From 66f0865034661e6ab31571697a3f31892deb815f Mon Sep 17 00:00:00 2001 From: Coty Getzelman Date: Wed, 10 Jul 2024 11:12:41 -0700 Subject: [PATCH] Removing UnityEngine reference inside of com.rlabrecque.steamworks.net.asmdef To improve compile times, I've removed the UnityEngine from the base of the plugin. The one reference was simply to pass along exception logging, so I've instead replaced it with a static delegate. In SteamManager.cs, you can hook into this delegate in OnEnable()/OnDisable(). --- .../Runtime/CallbackDispatcher.cs | 12 +++++++++--- .../Runtime/com.rlabrecque.steamworks.net.asmdef | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs b/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs index f27be5ea..7b02f554 100644 --- a/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs +++ b/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs @@ -34,10 +34,16 @@ public static class CallbackDispatcher { // We catch exceptions inside callbacks and reroute them here. // For some reason throwing an exception causes RunCallbacks() to break otherwise. // If you have a custom ExceptionHandler in your engine you can register it here manually until we get something more elegant hooked up. + + public delegate void OnSteamException(Exception e); + public static OnSteamException OnSteamExceptionEvent; + public static void ExceptionHandler(Exception e) { -#if UNITY_STANDALONE - UnityEngine.Debug.LogException(e); -#elif STEAMWORKS_WIN || STEAMWORKS_LIN_OSX + if(OnSteamExceptionEvent != null) { + OnSteamExceptionEvent.Invoke(e); + } + +#if STEAMWORKS_WIN || STEAMWORKS_LIN_OSX Console.WriteLine(e.Message); #endif } diff --git a/com.rlabrecque.steamworks.net/Runtime/com.rlabrecque.steamworks.net.asmdef b/com.rlabrecque.steamworks.net/Runtime/com.rlabrecque.steamworks.net.asmdef index 2692f320..e232ab70 100644 --- a/com.rlabrecque.steamworks.net/Runtime/com.rlabrecque.steamworks.net.asmdef +++ b/com.rlabrecque.steamworks.net/Runtime/com.rlabrecque.steamworks.net.asmdef @@ -16,5 +16,5 @@ "autoReferenced": true, "defineConstraints": [], "versionDefines": [], - "noEngineReferences": false + "noEngineReferences": true } \ No newline at end of file