Download

Centring Print String text?

Hi there,

is there a way to centre debug text using the print screen node.

It’s really affecting my eyes lol!

Centre? As in the centre of the screen? Wouldn’t that drive one insane in under a minute?


Not really afaik but you can also use this:

image

If you plug in a Test Base Actor, the Text Location becomes a local offset instead of the world location it is by default.

1 Like

Ok forgive my very little understanding of the DrawDebugString node and test base actors.

by using DrawDebugString is the text location automatically set to the location on the node or do I have to connect to that specific input?

What is the test base actor and how do I add this?

Apologies for being a pain

Thinking DrawDebugString probably won’t do what you want (not really). Unless the orientation of your camera is fixed in the level. So its not so good for 3D games (think 2d games with scrolling meshes / worlds and a fixed camera). :wink:

Overall, you may need something that’s attached to the camera and yet can display text. Think Widget or TextRender actor. Either attach them to the player camera at runtime or as part of the object hierarchy of the character at design time.

None of this is hard to do, but it will take some setup. The poor man solution meantime is maybe to left-pad all your print-strings using a horizontal screen resolution calc. But that will probably look so awful your eyes will hate you even more. :stuck_out_tongue:

Not sure if that’s what you need but it’s another way of displaying debug info. Rather than having it spam a wall of text in the upper left corner, you can have it attached to a world location. Here I’m showing some info about the drivable pawn:

…which results in:

It might be a tad easier to follow than messages in the output log or print text / string. if you do not plug in the test base actor, the Text Location will be World Location. In the example above, the location of the text is car’s location + Z offset in the Select node.

This is really situational and whether using it makes sense depends on what needs showing and what’s the context. If you’re serious about debugging, you write your own custom debugger with widgets, pipe in generic data and the widgets handle formatting & display. It would also give you the chance to add some functionality at this point. Tools like that are handy and the upfront cost of creating one is totally worth it!

And since we’re on the topic, there’s also the venerable HUD class that can do all kind of funky things no one else can:

It can draw text in screen space, lines, rectangles and so on… If you combine it with world projection nodes:

You can rapidly build a neat tool that shows what’s needed. It’s a framework class, it’s accessible from (almost) anywhere so you can talk to it with a BP Interface dedicated to showing debug info.

Ah Cool!

Thanks for that very much appreciated!

Can you show me how you got the test base actor as I can’t seem to get one in my level bp?

You can do it inside the actor.

But if you need to reference something in the LB, select an actor in the viewport or outliner and right click in the Level Blueprint graph. You’ll have an option to create a reference.

Ok thanks for that