For better debugging.

It would be great if I could have the object name and the function name that called a “Print” funciton in blueprint or “GEngine->AddOnScreenDebugMessage” in Cpp.
That way I could know where this message came from.
For now I have to do something like this in cpp:

GEngine->AddOnScreenDebugMessage(-1, 1.0f, FColor::Red, "ObjectName::FuncitonName: Message");

And the same in blueprint.

So it would be great if there would be a funciton like:
That can be called from anywhere.

There C++ feature for something like that, there FILE FUNC and even LINE macros, in compilation time they will be replaced with file , function name and line that they are correctly in. It’s very static solution but i guess there nothing better. Keep in mind that C++ code is compiled to native machine code that does not have functions or variables, just memory addresses and it’s really hard to do something like this dynamically, debuggers use so called symbols that translates memory addresses to places in code.

There docs aboput them here, remeber that only ANSI-Compliant will work on most compilers:

Sometimes you don’t want the object name of the object you’re in. For instance if you’re extending UStaticMeshComponent then the object name in game is StaticMeshComponent0 and the ACTUAL name of the object from the content browser is the root object. I guess it could output a path? I tend to do this for all my game objects anyway, just for verbosity.

I’d be keen on a filter in the output window, like how the message log works. Or even just a text filter. It’d be nice to have both the colouration of the output log in UE with the searching of the output log in the VS debugger.

Already Implemented

I already created a set of debug messages to give you class function and also exact line number here:

How to get a UE4 FString of Calling Class Function and Line Number