public Il2CppObjectBase(IntPtr pointer) { if (pointer == IntPtr.Zero) { throw new NullReferenceException(); } myGcHandle = RuntimeSpecificsStore.ShouldUseWeakRefs(IL2CPP.il2cpp_object_get_class(pointer)) ? IL2CPP.il2cpp_gchandle_new_weakref(pointer, false) : IL2CPP.il2cpp_gchandle_new(pointer, false); }
internal void CreateGCHandle(IntPtr objHdl) { if (objHdl == IntPtr.Zero) { throw new NullReferenceException(); } // This object already wraps an Il2Cpp object, skip the pointer and let it be GC'd if (isWrapped) { return; } myGcHandle = RuntimeSpecificsStore.ShouldUseWeakRefs(IL2CPP.il2cpp_object_get_class(objHdl)) ? IL2CPP.il2cpp_gchandle_new_weakref(objHdl, false) : IL2CPP.il2cpp_gchandle_new(objHdl, false); }