UE_LOG only once?

When using UE_LOG to log an information on output log, there is a way to write the log only once, even if the UE_LOG is inside a TICK() function, without having do any kind of execution flow control with a if statement?

I stumbled upon UE_CLOG(Condition, CategoryName, Verbosity, Format, ...) which might fit the bill. It’s conditional logging though, so you are still going to need a check of some sort.

What I do for loops when debugging is this:

GEngine->AddOnScreenDebugMessage(1, 1.0f, FColor::Green, FString::Printf(TEXT("Triggered")));

I’m not sure if you already knew, but the first parameter, if a positive number, sets the row for this message to appear in, so it will overwrite the message of the previous frame and not fill up the screen with log messages.

2 Likes

UE_LOG_ONLINE_ONCE does what you want.

1 Like