From d3b8b761fd70e7fd1213d379e61c6fe0be4b6876 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Tue, 9 Nov 2021 14:51:10 -0800 Subject: [PATCH 1/2] Improved messaging on assert about argument types lacking reflection for scripting Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp index b03d413507..f50506e0e0 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp @@ -3408,7 +3408,14 @@ LUA_API const Node* lua_getDummyNode() const BehaviorParameter* arg = method->GetArgument(iArg); BehaviorClass* argClass = nullptr; LuaLoadFromStack fromStack = FromLuaStack(context, arg, argClass); - AZ_Assert(fromStack, "Argument %s for Method %s doesn't have support to be converted to Lua!", arg->m_name, method->m_name.c_str()); + AZ_Assert(fromStack, + "The argument type: %s for method: %s is not serialized and/or reflected for scripting.\n" + "Make sure %s is added to the serialization context and reflected to the Behavior Context\n" + "For example, verify these two exist and are being called in a Reflect function:\n" + "serializeContext->Class<%s>();\n" + "behaviorContext->Class<%s>();\n" + "%s will not be available for scripting unless these requirements are met." + , arg->m_name, method->m_name.c_str(), arg->m_name, arg->m_name, arg->m_name, method->m_name.c_str()); m_fromLua.push_back(AZStd::make_pair(fromStack, argClass)); } From 934c0f2ec7d2b27fa12dc2e240d9a7a444de64a2 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Tue, 9 Nov 2021 15:25:06 -0800 Subject: [PATCH 2/2] Made SerializeContext and BehaviorContext consistent with their class name Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp index f50506e0e0..45f7876993 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp @@ -3410,7 +3410,7 @@ LUA_API const Node* lua_getDummyNode() LuaLoadFromStack fromStack = FromLuaStack(context, arg, argClass); AZ_Assert(fromStack, "The argument type: %s for method: %s is not serialized and/or reflected for scripting.\n" - "Make sure %s is added to the serialization context and reflected to the Behavior Context\n" + "Make sure %s is added to the SerializeContext and reflected to the BehaviorContext\n" "For example, verify these two exist and are being called in a Reflect function:\n" "serializeContext->Class<%s>();\n" "behaviorContext->Class<%s>();\n"