I attach them to Canvas Panel after creation. Will the be gone with the Panel, or I should delete them at EndPlay?
And how should I delete them, with delete operator or there is some function for this?
GC will destroys all UObjects that are not refrenced in any reflected pointer varable (marked with UPROPERTY()) every minute. But its nothing wrong to clean things for yourself
What about nonreflected properties? Should I use smartpointers?
I am storing UImage pointers in TMap associating them to AActor objects.
So while HUD is always holding refernces to UImage’s im ok. But it is only a matter of time when things will go wrong.
Engine don’t see nonreflected properties, so object will get collected and pointer will be invalid, i think TSheredPtr should work
About TMap, reflection system don’t see them either, i find this thred maybe it will help?
Keep in mind that only UObjects get garbage collected, if you ever cross pointers to diffrent types or non-UObject classes, those needs to be cleaned manually