Object references in TArray/TMap/and co

TArrays marked as UPROPERTY of UObjects (or structs flagged USTRUCT with their own UPROPERTY inside) participate fully in garbage collection. TMaps, unfortunately, do not, and will require that you implement the AddReferencedObjects function for the class to collect up the object references.

It is not valid to have arrays (or just a single instance) of Object/Actor. In general Object/Actor will always be interacted with as pointers.

I’m not quite clear on what you mean here, but if you mean that you have a situation like so:



TWeakObjectPtr<UObject> MyFunction()
{
   UObject* Obj;
   return Obj;
}


Yes, that is legal.