Unreal Engine 4 Tutorial – Output Message to Screen

Unreal Engine 4 Tutorial – Output Message to Screen

Okay, so this simple method of printing a message to the screen while playing a game, is good to use for small stuff. For example, if the player picks up a power-up of some sort, you might want to output a message on the game screen that tells the player it has now indeed picked up and activated that specific power up. And if the power is temporary, you again might want the message to be displayed when it’s turned off.

In the example I’ll use now, I’ll simply create a message that tells the player he has entered a “Safe Zone”, and then again that he has exited the Safe Zone.

1)

Thus, the first I do is create a ground mesh, and then a simple plane on top of it, which will function as the Safe Zone. Like this:

Safe Zone Plane

2)

Next step is to create a basic Box Trigger, and make sure the trigger’s volume covers the entirety of the Safe Zone-field (you could also simply make the plane into a trigger volume, but I prefer not to):

Basic Box Trigger Volume

3)

Now, we’ll make sure the on screen message will be printed both when the player enters and exits the Safe Zone. Thus, with the trigger selected, enter Blueprints,

right click –> AddEventForTriggerBox –> Collision –> Add OnActorBeginOverlap

and set up the next one as well:

right click –> AddEventForTriggerBox –> Collision –> Add OnActorEndOverlap

It should now look like this:

OnActorBeginOverlap OnActorEndOverlap Trigger


(adsbygoogle = window.adsbygoogle || []).push({});

4)

For the next part, we’ll do the same on both of these.

Right click in the Blueprints screen –> In the search box type in “print” and choose Print String

Blueprints Print String

Do this twice and connect both to each trigger overlap. In the BeginOverlap, write something like “You have entered the Safe Zone!”

In the EndOverlap, write: “You have left the Safe Zone!”

And if you want, choose text colors, and compile Full Report. It should now look like this:

print string compiled

5)

Play your game and witness the magic of your message being printed to the top left corner of the screen when the player enters and exits the Safe Zone:

You have entered the Safe Zone! You have left the Safe Zone!

6)

That’s it, you’re done. Simple as nothing. Also, I created a video tutorial dealing with this, in case you’d like to watch. However, in the video I’m also showing you how to change the pitch on an added sound to a trigger event.




4 Replies to “Unreal Engine 4 Tutorial – Output Message to Screen”

    • Unfortunately, no, I don’t think it’s possible to extend the life-time of the “Print String”. However, you can find another solution to create pop-up messages in-game in the tutorial “In-game Pop-up Text” which can be found in the Blueprint Classes-section.

    • Not with the print string-function. However, there exists much more powerful ways of displaying text, both inside the game world, and as UMG elements.

      Here’s one tutorial about in-game pop-up text using Blueprint classes: https://youtu.be/_SsvSGrah5c

      And here’s one where you learn enough about UMG to also use it to just make text on the screen: https://youtu.be/4VWc_sEg0kY

      Hope that helps!

Leave a Reply

Your email address will not be published.

*

twelve + sixteen =