TArray Add()

Hello,
I created a new object of type UStaticMeshComponent and immediately add it to the TArray of StaticMeshComponents.
However, the compiler writes that:
Error C2664 “int32 TArray <UStaticMeshComponent, FDefaultAllocator> :: Add (const UStaticMeshComponent &)”: cannot convert argument 1 from “UStaticMeshComponent &&”

Your TArray is an array of UStaticMeshComponent OBJECTS, not pointers (which is what you are trying to add, correctly).



TArray<UStaticMeshComponent*> SMArray; // Note the pointer type.


Thank you, this is what I need.

@ExtraLifeMatt End of 2020 and this information helped again. Props man!