ObjectExtensions.cs 548 B

123456789101112131415161718192021
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace Godot
  4. {
  5. public partial class Object
  6. {
  7. public static bool IsInstanceValid(Object instance)
  8. {
  9. return instance != null && instance.NativeInstance != IntPtr.Zero;
  10. }
  11. public static WeakRef WeakRef(Object obj)
  12. {
  13. return godot_icall_Object_weakref(Object.GetPtr(obj));
  14. }
  15. [MethodImpl(MethodImplOptions.InternalCall)]
  16. internal extern static WeakRef godot_icall_Object_weakref(IntPtr obj);
  17. }
  18. }