Download

RF_Standalone: What specifically does it do?

I added the RF_Standalone EObjectFlags to one of my objects created with NewObject. Does this mean that it will always exist until manually destroyed, or will only exist until the parent class is destroyed. It sounds like the first option, but what makes this any different than RT_RootSet which just avoids garbage collection on the object.

To add context to what I’m working on, I’m making a TArray that is a UProperty of a UClass. The containing class is being stored in a static variable of another class, so upon creation I can’t set the NewObject outer class to protect garbage collection. This causes Unreal to garbage collect the TArray’s objects, everything else in the class is fine. The only thing I could find would be to set one of the object tags to protect the TArray objects from the GC, but I don’t want to unnecessarily root set something if I don’t have to.

The documentation says the following:

| RF_Standalone | 0x00000002 | The Object is kept around for editing even if is not referenced by anything. |

Seems to work similar to RF_RootSet.

I also found code which marks objects to be root when they have a standalone tag.