Hi !
Currently, I’m trying to draw a lot of lines at runtime using the function DrawLine. However, it starts to get really non-performant as the number of lines go up (which is normal). I then stumbled upon the function DrawLines, which looks similar but is supposed to be better when drawing a lot of lines. I’ve been trying to replicate a simpler version of the DrawDebugBox function to make sure I’m using it correctly.
Here’s the problem : I get a link error whenever I try to use the function.
Error 1 error LNK2019: unresolved external symbol “public: void __cdecl ULineBatchComponent::DrawLines(class TArray<struct FBatchedLine,class FDefaultAllocator> const &)” (?DrawLines@ULineBatchComponent@@QEAAXAEBV?$TArray@UFBatchedLine@@VFDefaultAllocator@@@@@Z) referenced in function “public: virtual void __cdecl AActorFibers::BeginPlay(void)” (?BeginPlay@AActorFibers@@UEAAXXZ)
Here’s the small fragment of code I’m trying to use :
UWorld* currentWorld = GetWorld();
ULineBatchComponent* const LineBatcher = currentWorld->PersistentLineBatcher;
int numberOfLinez = 5000000;
TArray<struct FBatchedLine, FDefaultAllocator > linez;
linez.Empty();
for (int i = 0; i < numberOfLinez; ++i)
{
linez.Add(FBatchedLine(FVector(0.0f + i*0.05, 0.0f, 0.0f), FVector(0.0f + (i + 1)*0.05, 0.0f, 0.0f), FColor(255.0f, 0.0f, 0.0f), 100.0f,1.0f,8));
}
LineBatcher->DrawLines(linez);
Everything to me should be in order, but it’s clearly not, and I have no idea why, especially since I can use DrawLine…
Any help would be greatly appreciated, and if someone has other suggestions to my line drawing as an alternative to DrawLines, I’m all ears.
Thanks !