Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
 public static unsafe bool ToBool(this godot_bool godotBool)
 {
     return(*(bool *)&godotBool);
 }