Anybody has the expericence? How do I add my own defined components in a component array?

Hello, Here I have a question:
I personal create a array with spline component like:

 UPROPERTY(BlueprintReadWrite, Category="Traffic Routes", EditAnywhere)
  TArray<USplineComponent *> Routes;

and two spline meshes like :

 UPROPERTY(EditAnywhere)
  USplineComponent* RouteDirection0;
  UPROPERTY(EditAnywhere)
  USplineComponent* RouteDirection1;

in my head file.
And In my cpp files I add some points in the spline Components and then want them add in the 'Routes ’ array which I create in head file.
Is as simple as :

    Routes.Add(RouteDirection0);
  Routes.Add(RouteDirection1);

or there must be some other way???

Any Help will be appreciated!!!Thanks!!!

You con’t to create variables for each individual component, you can just store them in array. Those pointers are just for you to use, AActor has it own component array that keep track on registered components.

Thanks,got it.That will help.I’ve post some questions so far and It’s very kind of your to have patient to answer most of my questions. :slight_smile: