Skip to content

Commit

Permalink
修改:使用WITH_EDITOR宏包一下对蓝图recompile的处理
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyanghuang-tencent committed Nov 7, 2023
1 parent 2714757 commit a4d9b1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- 同一个Lua函数绑定多个不同签名的代理导致崩溃 [#660](https://github.com/Tencent/UnLua/pull/660)
- 应该支持从L构造FLuaValue类型 [#666](https://github.com/Tencent/UnLua/issue/666)
- 特定情况下在Lua中调用TArray的Add接口时内存对齐引起的问题 [#668](https://github.com/Tencent/UnLua/issue/668)
- 兼容蓝图Recompile导致FuncMap被清空的情况 [#669](https://github.com/Tencent/UnLua/issue/669)
- 清理一些UE5下的编译警告

### Changed
Expand Down
6 changes: 6 additions & 0 deletions Plugins/UnLua/Source/UnLua/Private/UnLuaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,15 @@ bool UUnLuaManager::BindClass(UClass* Class, const FString& InModuleName, FStrin

if (Classes.Contains(Class))
{
#if WITH_EDITOR
// 兼容蓝图Recompile导致FuncMap被清空的情况
if (Class->FindFunctionByName("__UClassBindSucceeded", EIncludeSuperFlag::Type::ExcludeSuper))
return true;

ULuaFunction::RestoreOverrides(Class);
#else
return true;
#endif
}

const auto L = Env->GetMainState();
Expand Down Expand Up @@ -325,6 +329,7 @@ bool UUnLuaManager::BindClass(UClass* Class, const FString& InModuleName, FStrin
}
}

#if WITH_EDITOR
// 兼容蓝图Recompile导致FuncMap被清空的情况
for (const auto& Iter : BindInfo.UEFunctions)
{
Expand All @@ -336,6 +341,7 @@ bool UUnLuaManager::BindClass(UClass* Class, const FString& InModuleName, FStrin
break;
}
}
#endif

if (auto BPGC = Cast<UBlueprintGeneratedClass>(Class))
{
Expand Down

0 comments on commit a4d9b1b

Please sign in to comment.