Skip to content

LoadVRMFileFromMemory crash in Standalone play #570

@ZeyrinPixel

Description

@ZeyrinPixel

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

  1. Set VRMConverter::SetImportMode(false)
  2. Call LoadVRMFileFromMemory() in a standalone build
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions