Crashed in the 50 line
void ASnake::AddSplineMeshComponents()
{
SplineMeshComponentArray.Empty();
const int32 Count = SplineComponent->GetNumberOfSplinePoints()-1;
PrintString(FString::Printf(TEXT("Count = %d"), Count));
49. UE_LOG(LogTemp, Warning, TEXT("Count = %d"), Count);
50. for (int32 i = 0; i < Count; i++)
51. {
52. FName Name = *FString::Printf(TEXT("SplineMeshComponent%d"), i);
53 USplineMeshComponent * SplineMeshComponent = NewObject<USplineMeshComponent>(this, Name);
if (IsValid(SplineMeshComponent) && IsValid(StaticMesh))
{
SplineMeshComponent->SetupAttachment(SplineComponent);
SplineMeshComponent->SetSimulatePhysics(true);
SplineMeshComponent->SetCollisionProfileName(TEXT("BlockAllDynamic"));
SplineMeshComponent->SetMobility(EComponentMobility::Movable);
SplineMeshComponent->SetStaticMesh(StaticMesh);
SplineMeshComponent->SetForwardAxis(InForwardAxis);
SplineMeshComponentArray.Add(SplineMeshComponent);
SplineMeshComponent->RegisterComponent();
}
}
}