参考文档 http://api.unrealengine.com/INT/API/Runtime/Engine/Components/ULineBatchComponent/index.html
.h
UFUNCTION(BlueprintCallable, Category = "Damage")
void DrawRayLine(FVector StartPos, FVector EndPos, float fLifeTime);
.cpp
//起点 终点 绘制线的显示的时间
void AMyActor::DrawRayLine(FVector StartPos, FVector EndPos, float fLifeTime)
{
ULineBatchComponent* const LineBatcher = GetWorld()->PersistentLineBatcher;
const float LifeTime = fLifeTime;
if (LineBatcher != NULL)
{
float LineLifeTime = (LifeTime > 0.f) ? LifeTime : LineBatcher->DefaultLifeTime;
LineBatcher->DrawLine(StartPos, EndPos, FLinearColor::Red, 10, 0.f, LineLifeTime);
}
}