DebugDrawLine Needs Two Calls to Draw One Line?

At the basic level, I’m trying to draw a single line from where the mouse started on a click to where it is now.

The only way I’ve been able to get this to work is by doing this:

// start position
		FVector StartWorldDirection;
		FVector StartPos;
		DeprojectScreenPositionToWorld(CursorInfo.StartPosition.X, CursorInfo.StartPosition.Y, StartPos, StartWorldDirection);
		DrawDebugLine((), FVector(), StartPos, FColor::Black, false, .1f);

		// current pos
		FVector EndDirection;
		FVector EndPos;
		DeprojectMousePositionToWorld(EndPos, EndDirection);
		DrawDebugLine((), FVector(), EndPos, FColor::Black, false, .1f);

What I’d like to do is combine the two statements into one like this:

DrawDebugLine((), StartPos, EndPos, FColor::Black, false, .1f);

Unfortunately the more simple call results in incorrect lines, or no lines at all. I’ve tried several combinations of the two methods, only the one shown at the top works. Is this a bug, or am I going about this the wrong way?

but 2nd argument suppose to be start point, you placing 0 vector there

Part of why I don’t understand why it works.

works what?

I don’t understand your question…

Heres some code from 4.9 that might help you out

	if (DrawDebugPoints)
	{
		FColor DebugColor = FLinearColor(0.8, 0.7, 0.2, 0.8).ToRGBE();
		if (isUnderwater) { DebugColor = FLinearColor(0, 0.2, 0.7, 0.8).ToRGBE(); } //Blue color underwater, yellow out of watter
		DrawDebugSphere((), worldTestPoint, TestPointRadius, 8, DebugColor);
	}

And a simple bp fucntion for drawing a line of any thickness between two actors from 4.8 but wait for the difference in 4.9

void MyBPFunctionLibrary::DrawActorDebugLines(AActor * StartActor, AActor * EndActor, FLinearColor LineColor, float Thickness, float Duration)
{
	if (!StartActor) return;
	if (!EndActor) return;
	//~~~~~~~~~~~~~~~~
	
	DrawDebugLine(
		StartActor->(), 
		StartActor->GetActorLocation(), 
		EndActor->GetActorLocation(), 
		FColor(LineColor), 
		false, 
		Duration, 
		0, 
		Thickness
	);
}

And in 4.9 it changes to

{
	if (!StartActor) return;
	if (!EndActor) return;
	//~~~~~~~~~~~~~~~~
	
	DrawDebugLine(
		StartActor->(), 
		StartActor->GetActorLocation(), 
		EndActor->GetActorLocation(), 
		LineColor.ToFColor(true),
		false, 
		Duration, 
		0, 
		Thickness
	);
}

If this cleared it up for you dont forget to accept an answer so people can find the answer they needed when searching/googleing later.

Hey, thanks for the response. Upgrading the project to 4.9 fixed the issue without having to change any of the code. Thanks though.