I also tried
void ASurfMeshGenerator::OnConstruction(const FTransform& Transform)
{
int32 SplinePoints = Spline->GetNumSplinePoints() - 1;
for (int32 i = 0; i < SplinePoints; ++i){
FVector Location, Tangent, LocationNext, TangentNext;
Spline->GetLocalLocationAndTangentAtSplinePoint(i, Location, Tangent);
Spline->GetLocalLocationAndTangentAtSplinePoint(i + 1, LocationNext, TangentNext);
auto *s = ConstructObject<USplineMeshComponent>(USplineMeshComponent::StaticClass(), GetOwner());
s->SetStaticMesh(Mesh);
s->SetStartAndEnd(Location, Tangent, LocationNext,TangentNext);
}
}
but s->SetStartAndEnd(Location, Tangent, LocationNext,TangentNext);
results also in an editor crash. Is ConstructObject
also wrong?