Description

Calling SetMassOverrideInKg reaches back to a "check(GEngine)" call in BodyInstance.cpp (line 2998). B/c of this check, the engine will crash on load if SetMassOverrideInKg is called inside a class constructor.

Steps to Reproduce
  1. Open UE4 Editor (any project)
  2. Add class to project based on Actor (MyActor)
  3. Close the editor
  4. In MyActor.h add the following:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
    UStaticMeshComponent* MyMesh;
    
  5. in MyActor.cpp add the following to the constructor:
    MyMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MyMesh"));
    MyMesh->SetMassOverrideInKg(" ", 1.0f);
    
  6. Compile
  7. Reopen the project

Result:
Editor gets to about 70% loading and then crashes

Callstack

MachineId:9FA88CA44B7C623122B0039D6C8BA1B0
EpicAccountId:67b2dfbf573f4ca89257ae6f4e56a46c

Access violation - code c0000005 (first/second chance not available)

""

UE4Editor_Engine!FBodyInstance::GetSimplePhysicalMaterial() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\physicsengine\bodyinstance.cpp:2998]
UE4Editor_Engine!FBodyInstance::UpdateMassProperties() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\physicsengine\bodyinstance.cpp:3135]
UE4Editor_Engine!UPrimitiveComponent::SetMassOverrideInKg() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\primitivecomponentphysics.cpp:498]
UE4Editor_MyProject3!AMyActor::AMyActor() [f:\unreal projects\myproject3\source\myproject3\myactor.cpp:14]
UE4Editor_CoreUObject!UClass::CreateDefaultObject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\coreuobject\private\uobject\class.cpp:2657]
UE4Editor_CoreUObject!UObjectLoadAllCompiledInDefaultProperties() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:658]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:752]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:921]
UE4Editor_Core!TBaseMulticastDelegate<void>::Broadcast() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:809]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\modules\modulemanager.cpp:426]
UE4Editor_Projects!FModuleDescriptor::LoadModulesForPhase() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\projects\private\moduledescriptor.cpp:370]
UE4Editor_Projects!FProjectManager::LoadModulesForProject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\projects\private\projectmanager.cpp:53]
UE4Editor!FEngineLoop::LoadStartupModules() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launchengineloop.cpp:1989]
UE4Editor!FEngineLoop::PreInit() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launchengineloop.cpp:1495]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launch.cpp:110]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll

Have Comments or More Details?

Head over to the existingAnswerHub thread and let us know what's up.

0
Login to Vote

Fixed
ComponentPhysics
Affects Versions4.10.44.114.12
Target Fix4.11
Fix Commit2885512
Main Commit2905127
CreatedFeb 25, 2016
ResolvedFeb 29, 2016
UpdatedApr 27, 2018