Can't see draw debug string, help!

Can’t see text of blueprint Draw debug string. At same location with same duration debug spere is OK, text can’t see.

Does it show when you draw just the text, without the sphere?

On my side 4.18 it working perfect with this code:

https://i.imgur.com/RvTxIos.png

here result

https://i.imgur.com/N2nLO4q.png

I think on your bp problem can be with text location. Try different locations - in my case this is weapon hit from Simple Trace by Channel - I’m just working on other things with it.

Working for sure.

ps. here result with text and sphere:

https://i.imgur.com/nJuK3zy.png

No, It doesn’t.

It doesn’t show whith “Eject” mode of viewing… In game - ok

Try Eject mode

How it’s started? From level bp tick or so?

from actor bp tick, next - do once, next - this debug

Yes, not working - report bug if you want.

Maybe text is displayed different way, like a billboards and it need player location, just sphere not need, is sphere. Dunno.

Hm, is this a VR project? I admit that this is a bit odd, indeed. These generally just work. Could you test it with some other object?

Alternatively, plug in self reference node into Test Base Actor and unplug Text Location. This will make the node pull the location from the actor.

I would bet you are generating a value on the far side we are not seeing. Then by the time the second object gets a chance at the position, it is different.

One possible problem (it literally took me YEARS to realize this) is, if you have your GameMode → HUDClass set to NONE, DrawDebugString will NOT work. I never used a HUD (because I use UMG widgets) and always thought the draw debug string was broken.

Also note, DrawDebugString only works in the game, not in editor, unfortunately.

15 Likes

THANK YOU!

1 Like

YES, THANK YOU SO MUCH!

To add to this - man it would be great if Epic could add editor viewport support to DrawDebugString (and make it not require a HUD class). It would be so useful for custom (blutility) editor tools and general level design too.

1 Like

Thank you, your last statement helped me. I had to run it in standalone game mode to see the debug sphere.

He I have the same problem when I am simulating in editor it draws nothing but when i PIE it works

This is very unlikely, but make sure you’re not calling this function in a server rpc, because these drawn out strings and spheres do not replicate. You’ll only be able to see it in this case if you run the game as a standalone or without a server or as a listen server, but not as a dedicated server.

I just ran into this problem myself. It’s unfortunate that we can’t have drawDebugHelpers that render text in editor mode for visualization of extra things. (How I got that working is another story)

DrawDebugString is coded to iterate through player controllers and get their HUD, and once all of that comes together, it adds the text to the HUD.

So it won’t work in editor mode, and it won’t work if there’s no HUD. Other draw debug helpers seem to work though.

void DrawDebugString(const UWorld* InWorld, FVector const& TextLocation, const FString& Text, class AActor* TestBaseActor, FColor const& TextColor, float Duration, bool bDrawShadow, float FontScale)
{
	// no debug line drawing on dedicated server
	if (GEngine->GetNetMode(InWorld) != NM_DedicatedServer)
	{
		check(TestBaseActor == NULL || TestBaseActor->GetWorld() == InWorld);
		AActor* BaseAct = (TestBaseActor != NULL) ? TestBaseActor : InWorld->GetWorldSettings();

		// iterate through the player controller list
		for( FConstPlayerControllerIterator Iterator = InWorld->GetPlayerControllerIterator(); Iterator; ++Iterator )
		{
			APlayerController* PlayerController = Iterator->Get();
			if (PlayerController && PlayerController->MyHUD && PlayerController->Player)
			{
				PlayerController->MyHUD->AddDebugText(Text, BaseAct, Duration, TextLocation, TextLocation, TextColor, true, (TestBaseActor==NULL), false, nullptr, FontScale, bDrawShadow);
			}
		}
	}
}
1 Like