C++ Debug text and Debug lines in construction script

Hello, I’ve just started programming in C++ and can’t figure out how to print debug text on screen and debug lines in world in my C++ construction script (OnConstruction). In blueprints, you can call “Print String” and “Draw Debug Line”. Both of these work in the construction script while the game is not running.

The C++ equivalent for “Print String” appears to be “GEngine->AddOnScreenDebugMessage()”, but this only works in runtime since it requires a world context. The alternative is UE_LOG, but this prints to the output log rather than the screen which for me is more user friendly.

Is there a way in C++ to get the exact same functionality as the blueprint’s version of “Print String” and “Draw Debug Line” which works in the construction script?

Many thanks!

Hey NfEWg1517,

You can look at the c++ implementation of most blueprint nodes through the api.

Here is a link to the API documentation on PrintString: UKismetSystemLibrary::PrintString

Also, while our new wiki is under construction, this page contains many useful references for how to create logs and print messages in c++


I hope you find this useful!