Widget reference Name=Invalid

So i’m working with widgets in C++, and for some reason, it gets to a point when the widget reference cannot be accessed, because its Name=Invalid:

I have no idea why this is happening. I have checked all the includes on other files, including the Target.cs, PlayerController and MyGame.h and all the includes appear to be correct.

Can someone tell me why this is happening and how to make it stop?
Here’s the constructor inside PlayerCon.cpp:

Thanks in advance!!

Did you mark it as UPROPERTY() ? Otherwise it will be Garbage Collected when you Call RemoveFromParent.

I did not. Didn’t know that either, thanks for the answer :smiley: i guess you can mark it as response!

Mark it as UPROPERTY() otherwise it will be Garbage Collected when you Call RemoveFromParent.

Just for Future refference you can convert a Comment to a Answer :stuck_out_tongue_winking_eye: but I did a Proper Answer Post so you can mark it as resolved.