# How to have an array of components on an actor

**URL:** <https://forums.unrealengine.com/t/how-to-have-an-array-of-components-on-an-actor/778454>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [February 25, 2023, 3:38pm UTC](https://forums.unrealengine.com/t/how-to-have-an-array-of-components-on-an-actor/778454 "2023-02-25T15:38:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chrstph3r](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrstph3r](https://forums.unrealengine.com/u/Chrstph3r)\
**Post date:** [February 25, 2023, 3:38pm UTC](https://forums.unrealengine.com/t/how-to-have-an-array-of-components-on-an-actor/778454/1 "2023-02-25T15:38:41Z")

</div>

Hello all, Im making a sort of “spline path traversal system”

The ideal setup is to have a guarenteed Start and End point and then add as many points as I need in between (these points are a custom USceneComponent that I have already made and tested) from there, utilizing the nav mesh system, I construct a spline based off of the path made between the points (already got working)

The problem is I want the in between points to be as modular as possible, Ideally I can place my “spline path actor” in the scene, set the start and end position and somehow add a new point within an array from the level so I can assign its special variables within the component and set its proper world location

 ![blender2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/6/c46b8a55716ad8bd82c9e98fe7983e98a8b933ab.png)

Ive attempted to have an array size that I could adjust in hopes that the constructor could add these points in a for loop but this doesnt do anything, not even add a new object to the array I defined

.cpp (in constructor method)

> Blockquote  
> PathStops.SetNum(numOfstops);

```
for (int32 i = 0; i < numOfstops; i++)
{

	FString name = "PathStop-";
	name.AppendInt(i);

	PathStops[i] = CreateDefaultSubobject<UPathStop>(FName(*name));
	PathStops[i]->SetupAttachment(root);
}

```

.h

> Blockquote

```
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pathfinding")
int32 numOfstops;

UPROPERTY(EditAnywhere, Instanced)
TArray<UPathStop*> PathStops;

```
