diff --git a/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs b/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs
index 47bcaecf..58ce3d6b 100644
--- a/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs
+++ b/com.rlabrecque.steamworks.net/Runtime/CallbackDispatcher.cs
@@ -31,10 +31,12 @@
namespace Steamworks {
public static class CallbackDispatcher {
+ public delegate void SteamworksExceptionHandler(Exception e);
+
// 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 static void ExceptionHandler(Exception e) {
+ // If you have a custom ExceptionHandler in your engine you can register it by setting ExceptionHandler
+ private static void DefaultExceptionHandler(Exception e) {
#if UNITY_STANDALONE
UnityEngine.Debug.LogException(e);
#elif STEAMWORKS_WIN || STEAMWORKS_LIN_OSX
@@ -42,6 +44,15 @@ public static void ExceptionHandler(Exception e) {
#endif
}
+ ///
+ /// Exceptions inside callbacks are caught and routed here.
+ ///
+ ///
+ /// By default, this is routed to but you can overrite it by setting it
+ /// to a valid .
+ ///
+ public static SteamworksExceptionHandler ExceptionHandler = DefaultExceptionHandler;
+
private static Dictionary> m_registeredCallbacks = new Dictionary>();
private static Dictionary> m_registeredGameServerCallbacks = new Dictionary>();
private static Dictionary> m_registeredCallResults = new Dictionary>();