GEngine not initialized! Problem

[link text][1]I am getting this error each time I launch my project in the output log, When I go to cook my project I get the same issue.

LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.
LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.
LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.
LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.
LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.
LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.
LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.
LogPhysics:Error: FBodyInstance::GetSimplePhysicalMaterial : GEngine not initialized! Cannot call this during native CDO construction, wrap with if(!HasAnyFlags(RF_ClassDefaultObject)) or move out of constructor, material parameters will not be correct.

90533-uat_log.txt (370 KB)

Hey ,

Thanks for bringing this to our attention, could you please answer a few questions?

  • Is this happening in 4.11 as well?
  • Are you working out of Binary or Source?
  • Can you reproduce this on a new template project?
  • Is your project blueprint only, c++ only, or a mixture of both?
  • Have you been able to package this specific project before? If so, what did you add into your project since?

Looking forward to hearing back from you!

Hey ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you!

Hey ,

I had the same error message in my project (4.11.2-2946394+++UE4+Release-4.11). The error mentions the constructor, but other than that it does not give much of a hint what to look for. At first I assumed I did something wrong in my material, where I use a Physical Material. After trying to reproduce this on a new project I figured out that the problem is in one of my constructors, I had: SetMassOverrideInKg(NAME_None, 500.0f, true);

A quick peek at the implementation of UPrimitiveComponent::SetMassOverrideInKg reveals a call to FBodyInstance::UpdateMassProperties(), which in turn calls FBodyInstance::GetSimplePhysicalMaterial(). If you use C++, maybe you could set a breakpoint in the “Engine\UE4” project, at
[\Source\Runtime\Engine\Private\PhysicsEngine\BodyInstance.cpp][1] and check the Call Stack to see how your code ends up there. (Line number may vary based on the engine version, but you can just search for “FBodyInstance::GetSimplePhysicalMaterial” around line 3091.)

I hope this helps someone!

https://github.com/EpicGames/UnrealEngine/blob/c8a4c30acebd28660affb7e8181b9c3247d3edb5/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodyInstance.cpp#L3091

8 Likes

Have you found any way to fix this? I’m dying here

Amcofi is one of our users who answered saying they were able to resolve their issue. If their advice does not help you, please submit a new question to AnswerHub for additional assistance. Please make sure you include logs and as many details as possible.

Thanks!

It was useful, thanks amcofi

To workaround this, used MyComponent->BodyInstance.bOverrideMass = true; Mesh->BodyInstance.SetMassOverride(0.f); instead of just SetMassOverrideInKG(); in any constructors.

Hope will be helpful!

4 Likes

Thanks BFG2k!! your solution works perfectly!!!
If you also need to change the center of mass, use:
MyComponent->BodyInstance.COMNudge = yourNewCenterOfMassFVector;

I had this issue recently. My problem was that I was trying to assign a Physical Material in the constructor of my class. I just moved that assignment into the BeginPlay() of the same class.

I’m reviving this topic because I feel like there is a lot of assumed knowledge required for the given solution to be useful. It took me a little while to understand, so I thought it might be helpful to detail what I did to trace it. If you are using C++ and don’t know how to find what’s causing this error, read on.

Firstly, to use breakpoints in Unreal, open the scripts in Visual Studio set your break points and then and then press F5. When the Unreal editor opens run your game and check the call stack when you hit a breakpoint.

If your breakpoints don’t work and you get an error message like “No symbols have been loaded”. Close the Unreal editor and when the Unreal launcher loads, navigate to: Unreal Engine>Library. Find the engine version you are trying to debug, click the down arrow to the right of the Launch button and select Options. In installation options, select “Editor symbols for debugging” (beware that it is a big download, 36.50 GB for me).

There might be better ways to approach it, but this worked for me.

1 Like

FYI this is still happening. Been sitting here for about an hour trying to figure out what the problem was and then I finally just copy and pasted the error in to google and found this post.

I removed the line “GameMesh->SetMassOverrideInKg(“None”, 100.0f, true);” and the game packages perfectly fine now.

I wrote that line a few days ago and just forgot all about that. But the error for this is so vague it’s really hard to track down.

1 Like

Thanks, you save me a headache

If you want to set mass for CDO (ie in c++ constructor) then you do it with GameMesh->GetBodyInstance()->SetMassOverride(100.0f, true);. This just sets the data and not try update the physics itself.