[C++] How to debug in the constructor

Hey guys

My current problem is i want the purple arrows to point to each other. Essentially I want to show what objects are linked in the viewport, but I’m unsure on 1 thing.

How can I debug the constructor of a class WHILE MY GAME IS NOT PLAYING? My UE_LOGS are not printing, I tried to make the variable visible in the details tab but it seems to be more editable rather than live updating.

any help would be greatly appreciated!

So do you want the arrows to update rotation in the constructor or do you want a property in the editor to update from the constructor and show its value live? To do that you would have to use post init properties function. Here is a link to the docs, near the top is a section called “setting defaults in my constructor” that talks about this. Let me know if that works.

Ideally both, I want the arrow to update rotation in the constructor, but I would like to know the live values of some of the vectors I’m calculating.

For example when moving my object around in the editor I would like to see that angle I’m trying to generate, whether it’s in a log or in the details tab.

I’m not sure if the link provided helps, I think I’m already doing that but I’ll double check when I get home

We can debug on screen like this. Just make the changes to print out your transform, rotation, etc. (will need header #include “Engine.h”)

if (GEngine != NULL) 
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("Hovering"));

Or in the logs likes this. Next to content browser labeled ‘Output Log’

UE_LOG(LogClass, Log, TEXT("Name: %s"), *FoundActors[i]->GetName());

Hope this helps debugging!

hmm, this is hard to explain, But i think its not the constructor i want, by doing a bit of research, I think theres a function i need to overwrite called OnConstructor? Since i want this to be called when moving the object in the editor like this

EDIT also looks like theres a virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; anyone seen or used these before?

SOLVED:

The problem is I wasn’t looking in the right spot, The constructor is only called when the object is compiled or placed into the world. I needed a function that was called EVERY time the object was moved, (much like the constructor in the blueprints).