I have a group of objects that are intended to last throughout the entire lifetime of the game. According to the garbage collection wiki page I would want to decorate its declaration with UPROPERTY(). What happens in the case of a TArray though? Would the following be sufficient:
Or is something else required? I assume that the TArray Add function acts as a copy constructor so I could just do TArray<CustomActor>, but I want to be able to pass around a pointer to the elements inside.
As an aside, if I need to return a TWeakObjectPtr in a function, can I just pass along the raw pointer and it'll get resolved automatically or do I need to do something explicit?
Code:
UPROPERTY() TArray<CustomActor *> objectArray;
As an aside, if I need to return a TWeakObjectPtr in a function, can I just pass along the raw pointer and it'll get resolved automatically or do I need to do something explicit?
Comment