I would like to ask how to destroy objects from Root Set (explicitly marked with RF_RootSet), as calling MarkPendingKill() throws an exception at assert: check(!IsRooted()). It seems that those objects cannot be deleted that way and I would like to know if removing RF_RootSet flag and then calling MarkPendingKill() is safe.
It seems that removing RF_RootSet is working but it’s important to remember that “Outer” has to be set to default value as changing that will cause the chain of references to point to our object and will throw an exception during GC.
I have class OrderQueue which is an array of instances of class derived from UObject in every unit in game (array of orders for units).
If I change OrderQueue to: UCLASS() UOrderQueue : public TArray {…} and use UPROPERTY() to mark that variable in unit, my orders will be properly GC (that is they will not be destroyed as long as they are in the array)?
If I mark TArray variable with UPROPERTY(), orders will be correctly GC (is UPROPERTY() on TArray enough and I don’t have to worry about using UPROPERTY() on UOrder)?
Hey @Rama, does this work for UPackage? Because Im using LoadPackageAsync as a form of caching the new level to be opened (I cant use streaming levels because i want to change the game mode, player controller and such).