How can I print an onscreen bool value?

A simpler way that doesn’t use macros and defines:

		bool myBool = true;

		if (GEngine)
		{
			const FString msg = FString::Printf(TEXT("Bool Status: %d"), myBool);
			GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, *msg);

			// or
			const FString msg2 = FString::Printf(TEXT("Bool Status: %s"), myBool ? TEXT("TRUE") : TEXT("FALSE"));
			GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, *msg2);
		}
1 Like