Actor array member gets cleared before play

Hi have an Actor that creates several UStaticMeshComponent’s and adds them to the RootComponent in the OnConstruction function. Additionally I add the pointers to these UStaticMeshComponent’s to a private member variable of type TArray.

class MYPROJECT_API AMyActor : public AActor
	TArray<UStaticMeshComponent*> m_aMeshComponents;	


Once BeginPlay is called this array is empty while the components still exists as children under the RootComponent.

Why is this array cleared and how can I prevent it? I need to iterate over these during play and don’t want to iterate the RootComponent’s children as they also contain other components.

Thanks in advance


It appears all my private member variables get reset by the time BeginPlay runs. I have a stored float that is filled with info also in the OnConstruction which is reset to zero somewhere.

Okay so this appears to be because the whole actor gets cloned, upon BeginPlay.

So as far as I can see the best option is to re-construct again upon BeginPlay.