internal static void CallDispose(IntPtr godotObjectGCHandle, godot_bool okIfNull) { try { var godotObject = (Object)GCHandle.FromIntPtr(godotObjectGCHandle).Target; if (okIfNull.ToBool()) { godotObject?.Dispose(); } else { godotObject !.Dispose(); } } catch (Exception e) { ExceptionUtils.LogException(e); } }
internal static void OnCoreApiAssemblyLoaded(godot_bool isDebug) { try { Dispatcher.InitializeDefaultGodotTaskScheduler(); if (isDebug.ToBool()) { DebuggingUtils.InstallTraceListener(); AppDomain.CurrentDomain.UnhandledException += (_, e) => { // Exception.ToString() includes the inner exception ExceptionUtils.LogUnhandledException((Exception)e.ExceptionObject); }; } } catch (Exception e) { ExceptionUtils.LogException(e); } }
public static unsafe bool ToBool(this godot_bool godotBool) { return(*(bool *)&godotBool); }