Unreal Engine 5 - Displaying Weapon Names on screen - FPS Part 23

Опубликовано: 30 Октябрь 2024
на канале: Unreal By Yourself
661
22

To display the weapon name on the player screen in Unreal Engine 5 (UE5), you can follow these steps:

Create a new widget blueprint: In the Unreal Editor, go to the "Blueprints" panel, right-click and select "Create a Blueprint Class." Choose "Widget Blueprint" as the parent class.

Add a text block to the widget: In the widget designer view, right-click and select "Add Element." Choose the "Text Block" element from the list. This text block will be used to display the weapon name.

Set up the text block: In the text block's properties, you can set its font, color, and other visual properties. You can also set its "Text" property to a default value, such as "Unarmed".

Bind the weapon name to the text block: In your game code, you'll need to keep track of the current weapon and its name. You can use a variable to store the weapon name and bind this variable to the text block in your widget blueprint. To do this, right-click in the graph view and select "Add Custom Event." In this event, you can use a "Set Text" node to update the text block's "Text" property with the current weapon name.

Display the widget: Finally, you can add the widget to the player's screen by using an "Add to Viewport" node in your widget blueprint. This node will display the widget on the screen.

This is just a basic outline, and the specifics will depend on your specific requirements for displaying the weapon name. You can find more information on creating UMG widgets in the Unreal Engine documentation.

If you learn something new, please like and subscribe.

Below, it the following tools that I use to create the video at no cost

Recording Program/ Enregistrement Gratuit
https://obsproject.com/

Video Editor Program/ Éditeur de vidéo gratuit
https://www.shotcut.org/

---------------------------------------------------------------------------

This is Unreal Engine, the best, in my opinion to create video, editing program, the game engine to create games, to creatively increase your knowledge, that keep you entertain at all time, with a lot of resources to help you out at anything and at anytime, creating games such as shooter, platformer, puzzle, racing and more, to create any video, cinematic and others. Don't heisted to try it out and the reward of perseverance to learn will be rewarding in the most satisfying way you can or cannot imagine. Keep the good word and create the best game of all time that will impact the world!