Cannot edit spline components created from c++

I’ve seen other users asking the same question but they are lost in the depths of Answerhub, so I try posting the question again. Spline components created from c++ cannot be edited in any way in Unreal Engine. The component on its own can be translated/rotated/scaled but not the single points nor any node can be created. Is there a solution or is it by design?

Sure, it is possible to move points from a spline in the editor, add, remove, even insert them. Do you have a specific issue or code that I could help you with?

Hi Michael,
maybe I haven’t explained myself well. I know that spline components can be modified in the editor, the problem is that spline components created in c++ cannot.
To try it out just derive a class from Actor, add a spline component pointer to it (in my case is an array of pointers) then create the spline in the constructor. The spline will be visible in the editor, it will also display all the nodes that have been created from c++ (with AddSplineWorldPoint) but it won’t be editable.
Also I’m not the only one who have exactly the same problem

Well, there is something else wrong in your case then, I just create one myself in C++ in a test actor and I can add, duplicate, remove points normally. I could right click and duplicate, or just hold Alt + drag a point to create a new one, or right click somewhere on the spline and do “Add Spline Point Here”.

Here is the full code of that class:

#pragma once

#include "GameFramework/Actor.h"
#include "TestActor.generated.h"

class USplineComponent;

UCLASS()
class TESTGAME_API ATestActor : public AActor
{
	GENERATED_UCLASS_BODY()
	
public:	
	UPROPERTY(EditAnywhere, Instanced, Category = "Path spline")
	USplineComponent* PathSpline;


	virtual void BeginPlay() override;
	virtual void Tick( float DeltaSeconds ) override;
};

#include "TestGame.h"
#include "Components/SplineComponent.h"
#include "TestActor.h"

// Sets default values
ATestActor::ATestActor(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	PrimaryActorTick.bCanEverTick = true;

	RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComp"));
	PathSpline = CreateDefaultSubobject<USplineComponent>(TEXT("Path"));

	PathSpline->AttachParent = RootComponent;
}

void ATestActor::BeginPlay()
{
	Super::BeginPlay();
}

void ATestActor::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
}

Hi Michaël,
first of all thank you for your time. It seems that the problem arises only with spline components contained in arrays. Try to change your code like this:
#pragma once

 #include "GameFramework/Actor.h"
 #include "TestActor.generated.h"
 
 class USplineComponent;
 
 UCLASS()
 class TESTGAME_API ATestActor : public AActor
 {
     GENERATED_UCLASS_BODY()
     
 public:    
     UPROPERTY(EditAnywhere, Instanced, Category = "Path spline")
	 TArray <USplineComponent*> PathSpline;
 
 
     virtual void BeginPlay() override;
     virtual void Tick( float DeltaSeconds ) override;
 };
 
 #include "TestGame.h"
 #include "Components/SplineComponent.h"
 #include "TestActor.h"
 
 // Sets default values
 ATestActor::ATestActor(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer)
 {
     PrimaryActorTick.bCanEverTick = true;
 
     RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComp"));
     PathSpline.Add(CreateDefaultSubobject<USplineComponent>(TEXT("Path")));
     PathSpline[0]->AttachParent = RootComponent;
 }
 
 void ATestActor::BeginPlay()
 {
     Super::BeginPlay();
 }
 
 void ATestActor::Tick( float DeltaTime )
 {
     Super::Tick( DeltaTime );
 }

and you won’t be able to edit the spline anymore. Which, more or less, bring me back to my original question: is this by design or am I doing something wrong declaring the array?

Indeed, I can reproduce your issue now. I’ll try figuring something out for the fun of it later, but this seems like a bug to me.

Thank you Michaël. I’ll submit a bug report since I’ve lost days trying to fix the problem with no avail.