Is your DrawDebugLine() Not working? I've got the solution for you!

So When I typed out

    DrawDebugLine(
	GetWorld(),
	PlayerViewPointLocation,
	LineTraceEnd,
	FColor(255, 0, 0),
	false,
	0.0f,
	0.0f,
	10.0f
	);

I was getting an error but to prevent this error if you come across it all you need to do is

#include "DrawDebugHelpers.h"
at the top of the file

Hope this helps :slight_smile:

8 Likes

This is a solved problem:) Read Above for details

1 Like

Thanks, the #include discrepancy is a persistent problem in these tutorials in newer versions of UE4 because of the changes they have made for better performance.

1 Like

I am having a persistent problem with red squigglies under GetWorld(), do you know what the problem is?

Sadly I have no solution that will get rid of them I also tried including

#include “Engine/World.h”

But to no avail :frowning:

In unreal there is destined to be a bunch of red squiggles sadly even so much my actual professional video game programming professor said so himself.

If anyone does find the solution feel free to let me know haha

If he says so, this one below is causing a compile failure for me right now (the GetWorld() bug does not), and so must be fixed. Don’t know what it is, already tried #include “Runtime/Engine/Classes/GameFramework/PlayerController.h” and it did not work, still compile failure.

Ok nevermind, just a typo. I typed FRotator PlayViewPointRotation; instead of FRotator PlayerViewPointRotation; the way I was supposed to… just thinking too fast I geuss, or not at all whatever the case may be I dunno.

Thanks for the help. I was a bit confused since the Unreal docs at the following link seems to suggest that a different header should be included. Still getting to know the documentation.

I have a link to a website that suggests
#include "DrawDebugHelpers.h"
is the file that you must include.
I have also tried both #includes and only “DrawDebugHelpers.h” works.

Here is the link: https://wiki.unrealengine.com/Draw_3D_Debug_Points,_Lines,_and_Spheres:_Visualize_Your_Algorithm_in_Action

I don’t know why there is a difference.

thanks man much appreciated =)

Please help me understand this:

The Documentation suggests usage of "Kismet/KismetSystemLibrary.h " [Link Here]

But what actually worked for me was the header you told, i.e. “DrawDebugHelpers.h”.

I was wondering if the header mentioned in Docs is wrong? And if it is not wrong, then why DrawDebugHelpers.h actually worked? Isn’t this redundant to define same functionality in two headers?