diff options
author | Ignacio Etcheverry <neikeq@users.noreply.github.com> | 2018-08-14 18:12:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 18:12:18 +0200 |
commit | d7b9fcd33689673c6237d91afdb4a8dfe548784a (patch) | |
tree | 3cf914ac9c765d439d49b07bb6b5bbe99332bcf5 /modules/mono/glue/cs_files/ObjectExtensions.cs | |
parent | bbdb6cf16ead5138bb18cbf435cdecd63bc7d4ab (diff) | |
parent | 9341129d149dfafa6b652d9a4a0ca32ccf3cef5f (diff) |
Merge pull request #20890 from KellyThomas/mono-is-instance-valid
mono: add IsInstanceValid(), move WeakRef()
Diffstat (limited to 'modules/mono/glue/cs_files/ObjectExtensions.cs')
-rw-r--r-- | modules/mono/glue/cs_files/ObjectExtensions.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/mono/glue/cs_files/ObjectExtensions.cs b/modules/mono/glue/cs_files/ObjectExtensions.cs new file mode 100644 index 0000000000..5c9e6609f4 --- /dev/null +++ b/modules/mono/glue/cs_files/ObjectExtensions.cs @@ -0,0 +1,17 @@ +using System; + +namespace Godot +{ + public partial class Object + { + public static bool IsInstanceValid(Object instance) + { + return instance != null && instance.NativeInstance != IntPtr.Zero; + } + + public static WeakRef WeakRef(Object obj) + { + return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj)); + } + } +} |