summaryrefslogtreecommitdiff
path: root/modules/mono/glue/Managed/Files/Extensions/ObjectExtensions.cs
blob: 9ef09597500f39f2d944dbf0b7cd86456d2a234b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Runtime.CompilerServices;

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 godot_icall_Object_weakref(Object.GetPtr(obj));
        }

        [MethodImpl(MethodImplOptions.InternalCall)]
        internal extern static WeakRef godot_icall_Object_weakref(IntPtr obj);
    }
}