当前位置:   article > 正文

UE4【蓝图】【修改蓝图属性导致UE4崩溃】_沉浸工程蓝图放了闪退

沉浸工程蓝图放了闪退

问题描述:项目一开始使用UE4.23,后来升级到UE4.24,出现修改蓝图组件属性,甚至UE4原生组件,比如灯光的Light的Channel都会导致UE4崩溃。

解决办法:

1.使用Reload,蓝图修改第一次不会崩溃,第二次依然会崩溃。

2.设置Projecting里的EditorStartMap为空,重新打开UE4 Editor,目的是保证我们要修改的蓝图,没有场景对象实例依赖或引用目标蓝图,修改蓝图属性正常。

3.比对UE4.25源码,发现是UE4的bug,并且已经在4.25修复,下面是diff文件,通过git合并到4.24源码中。

  1. Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp | 4 ++--
  2. 1 file changed, 2 insertions(+), 2 deletions(-)
  3. diff --git a/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp b/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp
  4. index ad31ca8b3be..4808717dc92 100644
  5. --- a/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp
  6. +++ b/Engine/Source/Runtime/CoreUObject/Private/UObject/LinkerLoad.cpp
  7. @@ -549,7 +549,7 @@ void FLinkerLoad::PRIVATE_PatchNewObjectIntoExport(UObject* OldObject, UObject*
  8. // Detach the old object to make room for the new
  9. const EObjectFlags OldObjectFlags = OldObject->GetFlags();
  10. - OldObject->ClearFlags(RF_NeedLoad|RF_NeedPostLoad);
  11. + OldObject->ClearFlags(RF_NeedLoad|RF_NeedPostLoad| RF_NeedPostLoadSubobjects);
  12. OldObject->SetLinker(nullptr, INDEX_NONE, true);
  13. // Copy flags from the old CDO.
  14. @@ -4489,7 +4489,7 @@ UObject* FLinkerLoad::CreateExport( int32 Index )
  15. {
  16. // For classes that are about to be regenerated, make sure we register them with the linker, so future references to this linker index will be valid
  17. const EObjectFlags OldFlags = Export.Object->GetFlags();
  18. - Export.Object->ClearFlags(RF_NeedLoad|RF_NeedPostLoad);
  19. + Export.Object->ClearFlags(RF_NeedLoad|RF_NeedPostLoad | RF_NeedPostLoadSubobjects);
  20. Export.Object->SetLinker( this, Index, false );
  21. Export.Object->SetFlags(OldFlags);
  22. }

其实就2行代码修改:

  1. //LinkerLoad::PRIVATE_PatchNewObjectIntoExport
  2. OldObject->ClearFlags(RF_NeedLoad|RF_NeedPostLoad);
  3. 修改为OldObject->ClearFlags(RF_NeedLoad|RF_NeedPostLoad| RF_NeedPostLoadSubobjects);
  4. //UObject* FLinkerLoad::CreateExport( int32 Index )
  5. Export.Object->ClearFlags(RF_NeedLoad|RF_NeedPostLoad);
  6. 修改为Export.Object->ClearFlags(RF_NeedLoad|RF_NeedPostLoad | RF_NeedPostLoadSubobjects);

最后将生成的UE4Editor-CoreUObject.pdb和UE4Editor-CoreUObject.dll替换目标引擎的Engine/Binaries/Win64目录下即可。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/108597?site
推荐阅读
相关标签
  

闽ICP备14008679号