UE4踩坑记录

1. 打包UE4时的编译错误UATHelper: 打包 (Windows (64-bit)): LogInit: Display: Loading text-based GConfig.... UATHelper: 打包 (Windows (64-bit)): Reflection code generated for G1S in 5.108943 seconds UATHelper: 打包 (Windows (64-bit)): Writing manifest to D:\UnrealEngine-Angelscript\Engine\Intermediate\Build\Manifest.xml UATHelper: 打包 (Windows (64-bit)): Building G1S... UATHelper: 打包 (Windows (64-bit)): Using Visual Studio 2022 14.32.31328 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.32.31326) and Windows 10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10). UATHelper: 打包 (Windows (64-bit)): Building 3 actions with 12 processes... UATHelper: 打包 (Windows (64-bit)): [1/3] Module.Core.7_of_16.cpp UATHelper: 打包 (Windows (64-bit)): D:\UnrealEngine-Angelscript\Engine\Source\Runtime\Core\Private\IO\IoStore.cpp(1411) : fatal error C1001: � ����������� UATHelper: 打包 (Windows (64-bit)): (�������ļ���D:\a\_work\1\s\src\vctools\Compiler\Utc\src\p2\main.c������ 220 ��) UATHelper: 打包 (Windows (64-bit)): Ҫ��������⣬�볢�Լ ������������λ�ø����ij��� UATHelper: 打包 (Windows (64-bit)): ������ԣ���� ˴��ṩ���ֲ���: https://developercommunity.visualstudio.com UATHelper: 打包 (Windows (64-bit)): ��ѡ�� Visual C++ UATHelper: 打包 (Windows (64-bit)): ���������˵��ϵġ�����֧�֡������ ���֧�ְ����ļ��������ϸ��Ϣ�� UATHelper: 打包 (Windows (64-bit)): cl!RaiseException()+0x6c UATHelper: 打包 (Windows (64-bit)): cl!RaiseException()+0x6c UATHelper: 打包 (Windows (64-bit)): cl!CloseTypeServerPDB()+0x2a4e3 UATHelper: 打包 (Windows (64-bit)): cl!CloseTypeServerPDB()+0xeeecb UATHelper: 打包 (Windows (64-bit)): UATHelper: 打包 (Windows (64-bit)): Took 13.7511663s to run UnrealBuildTool.exe, ExitCode=6 UATHelper: 打包 (Windows (64-bit)): UnrealBuildTool failed. See log for more details. (D:\UnrealEngine-Angelscript\Engine\Programs\AutomationTool\Saved\Logs\UBT-G1S-Win64-Shipping.txt) UATHelper: 打包 (Windows (64-bit)): AutomationTool exiting with ExitCode=6 (6) UATHelper: 打包 (Windows (64-bit)): BUILD FAILED PackagingResults: Error: Unknown Error

Visual Studio版本是`17.2.0 Preview 6.0 `

经过Google查询,找到一个帖子

Visual Studio Feedback

问题是编译器的BUG,修改办法为:

// File: Engine\Source\Runtime\Core\Private\IO\IoStore.cpp FIoStoreTocChunkInfo GetTocChunkInfo(const int32 TocEntryIndex) const { ... } // 改为: __declspec(noinline) FIoStoreTocChunkInfo GetTocChunkInfo(const int32 TocEntryIndex) const { ... } 2. 打包后Socket的位置丢失,获取的位置编程骨骼网格体组件的世界位置

我的骨骼网格体是Merge出来的,所以需要调用 `CompositeMesh->RebuildSocketMap()` 重建SocketMap,如果不重建很有可能在编辑器里是没问题的,但是打包就有问题了。

代码如下:

UFUNCTION(ScriptCallable) static USkeletalMesh* MergeSkeletalMesh(USkeletalMesh* pWpn, USkeletalMesh* pArm) { if (pArm == nullptr) return pWpn; const TArray InForceSectionMapping; USkeletalMesh* CompositeMesh = NewObject(GetTransientPackage(), NAME_None, RF_Transient); TArray SourceMeshList; SourceMeshList.Add(pWpn); SourceMeshList.Add(pArm); FSkeletalMeshMerge MeshMergeUtil(CompositeMesh, SourceMeshList, InForceSectionMapping, 0); if (MeshMergeUtil.DoMerge()) { CompositeMesh->RebuildSocketMap(); CompositeMesh->SetSkeleton(pWpn->GetSkeleton()); return CompositeMesh; } return pWpn; }

如果你有任何建议或疑问可以在下面 留言
发表第一条评论!