From f9a0b37eaaf1cad8b0e947133bc7b4cf07e2d1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E6=B2=9B=E5=92=8C?= Date: Sun, 30 Mar 2025 13:45:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DTSoftObjectPtr=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E7=BB=93=E6=9E=84=E4=BD=93=E7=AC=AC=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=8F=98=E9=87=8F=E6=97=B6metatable=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issues #723 提及:TSoftObjectPtr作为结构体第一个成员变量时metatable异常 --- .../Source/UnLua/Private/ReflectionUtils/PropertyDesc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/PropertyDesc.cpp b/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/PropertyDesc.cpp index 4ed09930..a762b8f7 100644 --- a/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/PropertyDesc.cpp +++ b/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/PropertyDesc.cpp @@ -416,7 +416,7 @@ class FSoftObjectPropertyDesc : public FPropertyDesc { public: explicit FSoftObjectPropertyDesc(FProperty* InProperty) - : FPropertyDesc(InProperty) + : FPropertyDesc(InProperty), bFirstPropOfScriptStruct(GetPropertyOuter(Property)->IsA() && Property->GetOffset_ForInternal() == 0) { } @@ -463,7 +463,7 @@ class FSoftObjectPropertyDesc : public FPropertyDesc } else { - UnLua::PushPointer(L, (void*)ValuePtr, "FSoftObjectPtr", false); + UnLua::PushPointer(L, (void*)ValuePtr, "FSoftObjectPtr", bFirstPropOfScriptStruct); } } } @@ -525,6 +525,9 @@ class FSoftObjectPropertyDesc : public FPropertyDesc return true; }; #endif + +protected: + bool bFirstPropOfScriptStruct; }; /**