Hello UE community,
i use this line in a method of a created Actor class, without it, everything works.
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("..."));
And I get this exception
Unhandled exception at 0x00007FFD5A87F5E4 (UE4Editor-Engine.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000000000000778.
The compiling stop at the if command from UnrealEngine.cpp
/** 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);
}
}
What I’m doing wrong?
Greetings!
Nsomnia
(Nsomnia)
September 9, 2015, 5:37pm
2
You need to have UE_BUILD_DEBUG as your build type for that line to work and
#if UE_BUILD_DEBUG
GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, "Some Message");
#endif
would be the proper way
Generally messages to the screen are printed something like this
UE_LOG(MyGame, Log, TEXT("Some Messsage") );
I highly reccomend reading Ramas post about debugging and printing messages here
After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
Reading time: 1 mins 🕑
Likes: 13 ❤
Hope this helps
Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.