diff options
author | Kelly Thomas <kelly.thomas@hotmail.com.au> | 2018-08-11 00:41:46 +0800 |
---|---|---|
committer | Kelly Thomas <kelly.thomas@hotmail.com.au> | 2018-08-14 15:48:54 +0800 |
commit | 9341129d149dfafa6b652d9a4a0ca32ccf3cef5f (patch) | |
tree | 4b6be8ec658e559ce28083ddaeb334276d48537c | |
parent | 6e0adf3656183602f3603b8a26319bcaf84eb7dd (diff) |
mono: add IsInstanceValid(), move WeakRef()
-rw-r--r-- | modules/mono/glue/cs_files/GD.cs | 5 | ||||
-rw-r--r-- | modules/mono/glue/cs_files/ObjectExtensions.cs | 17 | ||||
-rwxr-xr-x | modules/mono/glue/cs_files/VERSION.txt | 2 |
3 files changed, 18 insertions, 6 deletions
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs index 43de9156f2..0a5d703f27 100644 --- a/modules/mono/glue/cs_files/GD.cs +++ b/modules/mono/glue/cs_files/GD.cs @@ -192,10 +192,5 @@ namespace Godot { return NativeCalls.godot_icall_Godot_var2str(var); } - - public static WeakRef WeakRef(Object obj) - { - return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj)); - } } } 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)); + } + } +} diff --git a/modules/mono/glue/cs_files/VERSION.txt b/modules/mono/glue/cs_files/VERSION.txt index 7f8f011eb7..45a4fb75db 100755 --- a/modules/mono/glue/cs_files/VERSION.txt +++ b/modules/mono/glue/cs_files/VERSION.txt @@ -1 +1 @@ -7 +8 |