[Crash Report] Can't run the engine via code

/** Wrapper from int32 to uint64 */
void UEngine::AddOnScreenDebugMessage(int32 Key, float TimeToDisplay, FColor DisplayColor, const FString& DebugMessage)
{
if (bEnableOnScreenDebugMessages == true)
{
AddOnScreenDebugMessage( (uint64)Key, TimeToDisplay, DisplayColor, DebugMessage);
}
}

when it gets to the if statement, it crashes.

link text

Hi kostor,

It seems like there are multiple warnings/errors in the logs about the compiler not being able to find certain meshes and other things not related to that line of code. Could you please provide me with a copy of the project so that I can attempt to debug and find out why exactly the crash is occurring?

@ I’m now uploading it.

@ here you go :slight_smile:

I was able to find the problem. You’ll need to add:

#include "Engine.h"

to the top of your VikingKing.h file. This is needed whenever you’re using anything to do with GEngine, such as these print functions. Another safety measure is to always pre-empt this with having the compiler check to see if GEngine is being referenced like so:

static void printStr(FString str, int time = 5, FColor color = FColor::, int32 key = -1)
{
	if (GEngine)
	GEngine->AddOnScreenDebugMessage(key, time, color, str);
}

Doing this should stop your project from crashing on launch.

Please let me know if you need any more assistance. Have a nice day!

Alright! Thanks!