I’m using UE5 and mostly blueprints. I moved a particular function from an Actor Component to C++ and have been trying to expand its functionality. This function is a Tick function and I’m running into issues with drawing a debug line.
I’m trying to use the DrawDebugLine and it draws in-game, but I can’t get it to not persist. I set BPersistentLines to false but the lines remain on screen and clutter it up. Any ideas what I am doing wrong?
void UWire::WireScans()
{
FHitResult Hit(ForceInit);
FCollisionQueryParams collisionParams;
collisionParams.AddIgnoredActor(startActor);
collisionParams.AddIgnoredActor(endActor);
for (int i = 0; i < wirePoints.Num()-1; i++) {
FVector startPoint = wirePoints[i];//Set Start Point of Trace to location of i
FVector endPoint = wirePoints[i+1]; ///Set End Point of Trace to location of i+1
GetWorld()->LineTraceSingleByChannel(Hit, startPoint, endPoint, ECC_WorldDynamic, collisionParams);
DrawDebugLine(GetWorld(),startPoint, endPoint, FColor::Blue, false, 0.0f, true, 2.0f);
}
}