Setting the value of a SplineMeshComponent in constructor is crashing the editor

I am trying to create an USpineMeshComponent in the editor. But the editor crashes when I try to access a function inside it.

Something like that can be done via blueprints and not in c++ bugs me.

Just this code

TSubobjectPtr<USplineMeshComponent> TempSpineMeshPtr;
TempSpineMeshPtr = PCIP.CreateDefaultSubobject<USplineMeshComponent>(this, TEXT("LastSpline"));
TempSpineMeshPtr->SetStartAndEnd(FVector(0), FVector(0), FVector(0), FVector(0));

Before trying this, I tried to to create splinemeshcomponent in c++ through and array but it didn’t work.

I had reported it here https://answers.unrealengine.com/questions/100229/splinemeshcomponent-bugged-c.html and I got now answer.

So eventually, I tried something that was done with blueprints. Something like this.


It would be also helpful to know if splinemesh are actually workin on c++ or not.