Hi,
I created a custom AActor in c++, where i added a USceneComponent as root. Now i want to add multiple splines (USplineComponent) as childs of the RootComponent. However the splines seem to be read-only so i am not able to edit the spline points in editor. In the details tab i notice a warning message like below.
How do i fix this message to probably be able to edit the spline components in the viewport?
This is my code for the actor and component:
// MyActor.h
UCLASS()
class ARoadToolActor : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<URoadTool *> RoadSplines;
};
// MyActor.cpp
ARoadToolActor::ARoadToolActor(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
ActorRootComponent = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("CT-Root"));
RootComponent = ActorRootComponent;
AddSpline();
}
void ARoadToolActor::AddSpline() {
int32 index = RoadSplines.Add(NewObject<URoadTool>(RootComponent, URoadTool::StaticClass()));
RoadSplines[index]->RegisterComponent();
RoadSplines[index]->SetActive(true);
RoadSplines[index]->SetMobility(EComponentMobility::Movable);
RoadSplines[index]->AttachTo(RootComponent);
RoadSplines[index]->bSplineHasBeenEdited = true;
}
// MySplineComponent.h
UCLASS(ClassGroup = Utility, meta = (BlueprintSpawnableComponent))
class CITYTOOLS_API URoadTool : public USplineComponent
{
GENERATED_BODY()
};
Any help would be nice!