SplineComponent in TArray

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.

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.

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

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.

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.

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

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.

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: