Skip to content

Commit 2714757

Browse files
Merge pull request Tencent#669 from 610789338/develop
修正:兼容蓝图Recompile导致FuncMap被清空的情况
2 parents 1d98c85 + ac0ee9a commit 2714757

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Plugins/UnLua/Source/UnLua/Private/UnLuaManager.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,13 @@ bool UUnLuaManager::BindClass(UClass* Class, const FString& InModuleName, FStrin
258258
return false;
259259

260260
if (Classes.Contains(Class))
261-
return true;
261+
{
262+
// 兼容蓝图Recompile导致FuncMap被清空的情况
263+
if (Class->FindFunctionByName("__UClassBindSucceeded", EIncludeSuperFlag::Type::ExcludeSuper))
264+
return true;
265+
266+
ULuaFunction::RestoreOverrides(Class);
267+
}
262268

263269
const auto L = Env->GetMainState();
264270
const auto Top = lua_gettop(L);
@@ -319,6 +325,18 @@ bool UUnLuaManager::BindClass(UClass* Class, const FString& InModuleName, FStrin
319325
}
320326
}
321327

328+
// 兼容蓝图Recompile导致FuncMap被清空的情况
329+
for (const auto& Iter : BindInfo.UEFunctions)
330+
{
331+
auto& FuncName = Iter.Key;
332+
auto& Function = Iter.Value;
333+
if (Class->FindFunctionByName(FuncName, EIncludeSuperFlag::Type::ExcludeSuper))
334+
{
335+
Class->AddFunctionToFunctionMap(Function, "__UClassBindSucceeded");
336+
break;
337+
}
338+
}
339+
322340
if (auto BPGC = Cast<UBlueprintGeneratedClass>(Class))
323341
{
324342
lua_rawgeti(L, LUA_REGISTRYINDEX, Ref);

0 commit comments

Comments
 (0)