Say I have a giant class, “MyGame”, with way too many fields, and it needs a refactor. Let’s say I see a group of related fields and I think to myself, “let’s combine those fields into a single object.” Imagine something like this:
`
BEFORE:
class MyGame
{
… etc …
UPROPERTY()
TArray<AActor *> PinballActors;
TMap<int64, int> PinballIndex;
TMap<int, FColor> PinballColorTable;
… etc …
}
AFTER:
class MyGame
{
… etc …
FPinballManager PinballManager;
… etc …
}
`
Now, here’s my question: field PinballActors above is a TArray of Actor pointers, and is a UPROPERTY, and therefore, the garbage collector can find it, which is good. When I move it inside the PinballManager, it will still need to be “findable” by the garbage collector. My question is: do I have to make PinballManager a UObject in order for it to contain UPROPERTY fields? Should it be a UObject?