Download

How to control the order of objects being garbage collected

I have a Character. Character is wearing a piece of equipment. This equipment is an Actor. Then, during garbage collection, the equipment is recycled first, revealing the naked model of the character. How to solve this problem? How to ensure that the Character is recycled before the equipment is recycled

Either:

A.) Set the Actor as invisible so it doesn’t matter if they go naked.
or
B.) Actor still keeps a reference to the Equipment (via UPROPERTY) and so when the Actor gets cleaned up, that final reference will get cleaned up and the equipment will be cleaned up in the next GC cycle.