Download

Actor destroy delegate

Hi, I am programming a strategy game tile system. Each tile holds a pointer to an Actor.
Now, when the actor gets destroyed, I need to set that pointer back to NULL.

Using a weak pointer for validation doesn’t work (because no UObject Support for smart pointers).
Is there a default OnDestroyed Delegate which I can bind to with my tile?

Check the parent class (from which is your object inherting), I suppose it is AActor and then override the destructor.

Google for the AActor class, but I think override destroy() does it all.
Hint: You should still use super()-function when overriding.
At this point you can delete your pointer and set to null.

I would want a solution in which the actors stay untouched. So like the TileManager does his own thing, and I don’t need an extra hierarchy level for it.