# SplineComponent in TArray

**URL:** <https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540>\
**Category:** C++\
**Tags:** tarray, bug, unreal-engine, Spline, UE4, CPP, question\
**Created:** [March 4, 2016, 2:25pm UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540 "2016-03-04T14:25:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MenosGrandes](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MenosGrandes](https://forums.unrealengine.com/u/MenosGrandes)\
**Post date:** [March 4, 2016, 2:25pm UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540/1 "2016-03-04T14:25:00Z")

</div>

I Have no idea why I can’t edit the SplineComponent in Editor.  
I have simple ActorComponent :

ULBranchActorComponent .h

```
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MGR_API ULBranchActorComponent : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	ULBranchActorComponent();

	// Called when the game starts
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LTree-BranchComponent")
	class USplineComponent*	m_thisBranch;
		
	
};

```

ULBranchActorComponent.cpp

```
ULBranchActorComponent::ULBranchActorComponent()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
	// off to improve performance if you don't need them.
	bWantsBeginPlay = true;
	PrimaryComponentTick.bCanEverTick = true;

	 m_thisBranch = CreateDefaultSubobject<USplineComponent>(TEXT("branch"));
	m_thisBranch->Activate(true);
	m_thisBranch->bSplineHasBeenEdited = true;
	m_thisBranch->MarkRenderStateDirty();
	m_thisBranch->SetRelativeLocation(FVector(0, 0, 0));
	// ...
}

```

Then in Actor **LTree** i have :

```
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "LTree")
 TArray<class ULBranchActorComponent *>m_Branch;

```

And when I want to add a ULBranchActorComponent i call this :

```
ULBranchActorComponent *branch = NewObject<ULBranchActorComponent>(this, TEXT("branch"));
branch->m_thisBranch->Activate(true);
branch->m_thisBranch->bSplineHasBeenEdited = true;
branch->m_thisBranch->MarkRenderStateDirty();
m_Branch.Add(branch);

```

And in Editor I can’t edit those splines, like normal spline so left click and context menue.

I have changed the SplineComponent.h with this [Spline not editable when set in Construction Script - Blueprint - Unreal Engine Forums](https://forums.unrealengine.com/showthread.php?84001-Spline-not-editable-when-set-in-Construction-Script).

So when i have single SplineComponent NOT ULBranchcomponent I’m able to edit this spline. But I want to have multiple splines in one Actor.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 4, 2016, 5:08pm UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540/2 "2016-03-04T17:08:14Z")

</div>

Hey MenosGrandes-

There is an open bug about not being able to edit or add nodes to an array of splines created in code (UE-14064). If you are trying to have multiple splines then the best option currently is to do so through blueprints.

Cheers

---

<div class="post-metadata">

**Author:** ![MenosGrandes](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MenosGrandes](https://forums.unrealengine.com/u/MenosGrandes)\
**Post date:** [March 4, 2016, 8:54pm UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540/3 "2016-03-04T20:54:22Z")

</div>

Could you give any tips how to do this in bp?  
When I’m adding a dynamic spline, simply using AddSplineComponent the Spline does’nt show up. Only when I have SplineComponent added by the big green button “+Add component”. But I don’t know how much Splines i will need.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 8, 2016, 3:18pm UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540/4 "2016-03-08T15:18:40Z")

</div>

Hey MenosGrandes-

I apologize for the delayed response. I did not realize you were attempting to add spline components dynamically. Unfortunately this is not a feature that is available. What exactly are you trying to accomplish? Depending on what the end goal is there may be another way around using dynamic splines.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_98778e19](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_98778e19](https://forums.unrealengine.com/u/anonymous_user_98778e19)\
**Post date:** [October 3, 2016, 6:58am UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540/5 "2016-10-03T06:58:46Z")

</div>

“Unfortunately this is not a feature that is available.”  
But what’s the ‘Add Spline Component’ node in the blueprint for?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [October 3, 2016, 12:53pm UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540/6 "2016-10-03T12:53:49Z")

</div>

The “Add Spline Component” node can be used to add a spline during runtime. MenosGrandes is attempting to add splines to his actor that can be edited in the editor outside of runtime.

---

<div class="post-metadata">

**Author:** ![ABrookesy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ABrookesy](https://forums.unrealengine.com/u/ABrookesy)\
**Post date:** [November 6, 2022, 12:20am UTC](https://forums.unrealengine.com/t/splinecomponent-in-tarray/349540/7 "2022-11-06T00:20:49Z")

</div>

From 2022, I am also trying to add multiple splines to a blueprint in the editor for some tooling I am making. I have a blueprint that would be best as a single blueprint with multiple splines - I’m making modular train tracks on a spline using instanced static mesh components, and I want to have multiple disconnected tracks running on the same ISMC’s.

This is a ‘call in editor’ function that does add a spline to the array (I can see it in the public array value when I click the call in editor button), but I can’t see the spline in the editor viewport, and I can’t see the spline component in the instantiated blueprint’s component hierarchy in the details panel:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/7/637642c1f0ffd6cbdfb36e18b044745d4187be9a.png)
