diff --git a/Source/Editor/CustomEditors/Values/ValueContainer.cs b/Source/Editor/CustomEditors/Values/ValueContainer.cs index 61c223835..9125b7006 100644 --- a/Source/Editor/CustomEditors/Values/ValueContainer.cs +++ b/Source/Editor/CustomEditors/Values/ValueContainer.cs @@ -242,7 +242,7 @@ namespace FlaxEditor.CustomEditors if (objA == null && objB is string objBStr && objBStr.Length == 0) return true; - return Newtonsoft.Json.Utilities.MiscellaneousUtils.DefaultValueEquals(objA, objB); + return Newtonsoft.Json.Utilities.MiscellaneousUtils.ValueEquals(objA, objB); } /// diff --git a/Source/Engine/Engine/NativeInterop.cs b/Source/Engine/Engine/NativeInterop.cs index eb37731b7..77445e8e5 100644 --- a/Source/Engine/Engine/NativeInterop.cs +++ b/Source/Engine/Engine/NativeInterop.cs @@ -2622,13 +2622,13 @@ namespace FlaxEngine } [UnmanagedCallersOnly] - internal static byte TypeIsSubclassOf(ManagedHandle typeHandle, ManagedHandle othertypeHandle, byte checkInterfaces) + internal static byte TypeIsSubclassOf(ManagedHandle typeHandle, ManagedHandle otherTypeHandle, byte checkInterfaces) { - if (typeHandle == othertypeHandle) + if (typeHandle == otherTypeHandle) return 1; Type type = Unsafe.As(typeHandle.Target); - Type otherType = Unsafe.As(othertypeHandle.Target); + Type otherType = Unsafe.As(otherTypeHandle.Target); if (type == otherType) return 1; @@ -2642,6 +2642,14 @@ namespace FlaxEngine return type.IsSubclassOf(otherType) ? (byte)1 : (byte)0; } + [UnmanagedCallersOnly] + internal static byte TypeIsAssignableFrom(ManagedHandle typeHandle, ManagedHandle otherTypeHandle) + { + Type type = Unsafe.As(typeHandle.Target); + Type otherType = Unsafe.As(otherTypeHandle.Target); + return (byte)(type.IsAssignableFrom(otherType) ? 1 : 0); + } + [UnmanagedCallersOnly] internal static byte TypeIsValueType(ManagedHandle typeHandle) { diff --git a/Source/Engine/Scripting/DotNet/MonoApi.cpp b/Source/Engine/Scripting/DotNet/MonoApi.cpp index 307d0585f..53d1b851e 100644 --- a/Source/Engine/Scripting/DotNet/MonoApi.cpp +++ b/Source/Engine/Scripting/DotNet/MonoApi.cpp @@ -1239,6 +1239,12 @@ MONO_API mono_bool mono_class_is_subclass_of(MonoClass* klass, MonoClass* klassc return CoreCLR::CallStaticMethod(TypeIsSubclassOfPtr, ((CoreCLRClass*)klass)->GetTypeHandle(), ((CoreCLRClass*)klassc)->GetTypeHandle(), check_interfaces); } +MONO_API mono_bool mono_class_is_assignable_from(MonoClass *klass, MonoClass *oklass) +{ + static void* TypeIsAssignableFrom = CoreCLR::GetStaticMethodPointer(TEXT("TypeIsAssignableFrom")); + return CoreCLR::CallStaticMethod(TypeIsAssignableFrom, ((CoreCLRClass*)klass)->GetTypeHandle(), ((CoreCLRClass*)oklass)->GetTypeHandle()); +} + MONO_API char* mono_type_get_name(MonoType* type) { CoreCLRClass* klass = (CoreCLRClass*)mono_type_get_class(type);