Disclaimer:
I spent a long time working through this issue on many different attempts, so this report is a best attempt at collecting the actual changes that fixed it. Was also working on issue #569 during this so they may be related.
Description
Loading VRM files at runtime using LoadVRMFileFromMemory with SetImportMode(false) crashes in UE 5.7 standalone builds. Works in PIE.
Seems to be a result of some PostLoad changes in UE 5.7?
Environment
- Unreal Engine: 5.7
- VRM4U Version: VRM4U_5_7_20260219
- Platform: Windows
Reproduction
- Set
VRMConverter::SetImportMode(false)
- Call
LoadVRMFileFromMemory() in a standalone build
- Crash occurs
Crashes
| Location |
Error |
Line |
| LoaderBPFunctionLibrary.cpp |
Assertion failed: Pair != nullptr (PostLoad) |
~841 |
| LoaderBPFunctionLibrary.cpp |
Assertion failed: Pair != nullptr (VRMSetPhysicsAsset) |
~847 |
| VrmConvertMorphTarget.cpp |
EXCEPTION_ACCESS_VIOLATION (GetCurveMetaData) |
~439 |
Root Cause
Runtime-created skeletal meshes in UE 5.7 have uninitialized internal state:
SkeletalMesh->PostLoad() fails - mesh description not created
USkeleton->GetCurveMetaData() fails - internal TMap not initialized
Suggested Fix
Wrap operations in IsImportMode() checks:
LoaderBPFunctionLibrary.cpp:
if (VRMConverter::IsImportMode()) {
out->SkeletalMesh->PostLoad();
}
if (VRMConverter::IsImportMode()) {
VRMSetPhysicsAsset(...);
}
VrmConvertMorphTarget.cpp:
USkeleton* skeleton = VRMGetSkeleton(sk);
if (skeleton != nullptr && VRMConverter::IsImportMode()) {
// curve metadata code
}
Also need to call PostEditChange() (editor) or InitResources() (runtime) when bSkipMorphTarget=true, since ConvertMorphTarget normally handles mesh finalization.
Workaround
Partial: Set Options.bSkipMorphTarget = true and Options.bSkipRetargeter = true. PostLoad crash still requires plugin modification.
Disclaimer:
I spent a long time working through this issue on many different attempts, so this report is a best attempt at collecting the actual changes that fixed it. Was also working on issue #569 during this so they may be related.
Description
Loading VRM files at runtime using
LoadVRMFileFromMemorywithSetImportMode(false)crashes in UE 5.7 standalone builds. Works in PIE.Seems to be a result of some PostLoad changes in UE 5.7?
Environment
Reproduction
VRMConverter::SetImportMode(false)LoadVRMFileFromMemory()in a standalone buildCrashes
Assertion failed: Pair != nullptr(PostLoad)Assertion failed: Pair != nullptr(VRMSetPhysicsAsset)EXCEPTION_ACCESS_VIOLATION(GetCurveMetaData)Root Cause
Runtime-created skeletal meshes in UE 5.7 have uninitialized internal state:
SkeletalMesh->PostLoad()fails - mesh description not createdUSkeleton->GetCurveMetaData()fails - internal TMap not initializedSuggested Fix
Wrap operations in
IsImportMode()checks:LoaderBPFunctionLibrary.cpp:
VrmConvertMorphTarget.cpp:
Also need to call
PostEditChange()(editor) orInitResources()(runtime) whenbSkipMorphTarget=true, sinceConvertMorphTargetnormally handles mesh finalization.Workaround
Partial: Set
Options.bSkipMorphTarget = trueandOptions.bSkipRetargeter = true. PostLoad crash still requires plugin modification.