Download

Dynamic Component add

I have question about adding dynamically component, in this case it’s SplineComponent, and then edit it in Editor. So adding SplinePoints, moving them etc.

So I have :


	USplineComponent* branch = NewNamedObject<USplineComponent>(this, TEXT("branch"));
	
	branch->Activate(true);
	branch->bSplineHasBeenEdited = true;
	branch->SetActive(true, true);
	branch->RegisterComponent();
	branch->AttachTo(RootComponent);

	m_Branch.Add(branch);

And its works fine. Spline is created but in Editor I have :
“Native components are editable when declared as a UProperty in c++”

But how can i declare this branch as UProperty ?

Of course the TArry is :


	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LTree")
	 TArray<class USplineComponent *>m_Branch;