Draw Debug Lines Between Actors In An Array

You are using a TArray, so you can use an iterator which gives you the current actor.

Put your start vector outside the loop, and update after each iteration. When you draw a line, check it wasnt the first iteration…

The code below should do what you want, but is untested.



 FVector LinkStart = FVector::ZeroVector;

for (auto Itr(NodesInThisWay.CreateIterator()); Itr; Itr++)
{
    AOSMNodeActor* currNode = cast<AOSMNodeActor*>(Itr);

    FVector LinkEnd = currNode->GetActorLocation();

			
    if (LinkStart != FVector::ZeroVector) {
	DrawDebugLine(
		GetWorld(),
		LinkStart,
		LinkEnd,
		FColor(255, 0, 0),
		true, -1, 0,
		12.333
		);
	}
    }
    LinkStart = LinkEnd;
}