From 8898c20ad1c7809cfead0df0374b4dd142c84065 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 25 Feb 2024 23:40:14 +0100 Subject: [PATCH] Fix crash when using generic interface in C# #1983 --- Source/Engine/Engine/NativeInterop.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Engine/Engine/NativeInterop.cs b/Source/Engine/Engine/NativeInterop.cs index 2c606465c..eab2ba942 100644 --- a/Source/Engine/Engine/NativeInterop.cs +++ b/Source/Engine/Engine/NativeInterop.cs @@ -1679,6 +1679,8 @@ namespace FlaxEngine.Interop /// internal static ManagedHandle GetTypeManagedHandle(Type type) { + if (type.IsInterface && type.IsGenericType) + type = type.GetGenericTypeDefinition(); // Generic type to use type definition handle if (managedTypes.TryGetValue(type, out (TypeHolder typeHolder, ManagedHandle handle) tuple)) return tuple.handle; #if FLAX_EDITOR