From bfaa292b04ae6c793a0d9ab4e4b161cdc52a8687 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 26 Oct 2023 11:37:37 +0200 Subject: [PATCH] Fix invoking managed method on value types (eg. `Transform`) to properly handle instance value #1801 --- Source/Engine/Engine/NativeInterop.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Engine/NativeInterop.cs b/Source/Engine/Engine/NativeInterop.cs index 2f74e421c..fea1fadda 100644 --- a/Source/Engine/Engine/NativeInterop.cs +++ b/Source/Engine/Engine/NativeInterop.cs @@ -1302,7 +1302,8 @@ namespace FlaxEngine.Interop #if !USE_AOT internal bool TryGetDelegate(out Invoker.MarshalAndInvokeDelegate outDeleg, out object outDelegInvoke) { - if (invokeDelegate == null) + // Skip using in-built delegate for value types (eg. Transform) to properly handle instance value passing to method + if (invokeDelegate == null && !method.DeclaringType.IsValueType) { List methodTypes = new List(); if (!method.IsStatic)