Labels for items on the ground

Hi all,

I’m stuck with creating my item system in c++.

I created an Item class in c++. Now I want to display a label above my items that are on the ground. The label should be the name variable from my item class and should have a black background. Then when I click on the label I should be able to perform my ItemPickup(); function.

What’s the best way to achieve this?

Should I be using UMG and blueprints to achieve this or can I do everything in code?

Any example code or blueprints would be greatly appreciated, since there is so few documentation around for UE4 :frowning:

thanks in advance!

Hello Stellarbe,

If you only wish for it to be a label and not be interactive in any way, you should be able to do everything you need to do using a TextRenderComponent. You could set it to be offset from the position of the item so that it is above it. You also (if this is your intended functionality) will need to code it so that the text will always face the character.

For more complex options, I’d suggest using UMG and using a hybrid of UMG and C++. If you go down this route, setting up the widget’s properties and looks would be most easily done through the editor itself and then you could call said widget with code.

Although this is all in blueprints, this should be able to help: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums