Fix regression from #1312 when passing structure from C++ to C# thunk as already boxed value

This commit is contained in:
Wojtek Figat
2023-10-05 11:35:52 +02:00
parent 86d1d29820
commit 9af6048bec

View File

@@ -685,8 +685,10 @@ namespace FlaxEngine.Interop
T value = default;
if (nativePtr == IntPtr.Zero)
return value;
MarshalHelper<T>.ToManaged(ref value, nativePtr, false);
if (typeof(T).IsValueType)
value = (T)ManagedHandle.FromIntPtr(nativePtr).Target;
else
MarshalHelper<T>.ToManaged(ref value, nativePtr, false);
return value;
}