Bind Widget

Hi, I’m working on a 3D Point and Click game but I have some difficulties to set up the items names widget. Basically i want to bind the Item name variable from the Item actor to the Text in the widget. I created an actor as Item Base added a text variable called Item Name which i can change in the child blueprints. I made a widget that i added to the Item Base and set it invisible. When i move the cursor over the item the widget will be visible displaying the name. I found a video online but that was for a first person gameplay with linetrace but i want make it work when i move the cursor over. I can set up the items individually but then I need a lots of widgets and items. Please help me.

Would like some mor details on your current setup (screenshots, souce code always help, and give back to the community).

If you already have an item actor, the item actor itself would contain a widget component. I assume you already set up whis widget component to display the item name (say, during the actor’s BeginPlay or similar setup event). Then you’d only have to change the visibility of the widget when the cursor hovers over the item actor right? Then I’m not sure where your problem is in the code?

And are you a blueprint or c++ user?

References:

There’s the widget component which can be added to any actor, to render any UserWidget:

UWidgetComponent | Unreal Engine 5.6 Documentation | Epic Developer Community

There’s the “BeginPlay” method, which can be used by an actor to perform self setup. You can pass on its item name to its widget component there:

BeginPlay() method. What is it?

There are methods to get content under the cursor position:

Using a Single Line Trace (Raycast) by Channel in Unreal Engine | Unreal Engine 5.6 Documentation | Epic Developer Community

APlayerController::DeprojectMousePositionToWorld | Unreal Engine 5.6 Documentation | Epic Developer Community

My idea is, if you have already set up the widget component to use the item name from its owning Item Actor, the challenge that remains is that you need to control the Widget Component visibility. It should be visible when the cursor is over the Item Actor, and invisible when not? Or where else are you facing a challenge?

The point of programming is to set up this logic just once in a base class. You’d inject the item information (item name, an icon, maybe a description), but one code class can handle that injection.

Linking that video and pointing out where you get stuck helps as well.

Sorry for the confusion.
I set up the ItemBP like this:


It’s works fine it show and hides the text correctly.
The problem is that i want to Bind the ItemName variable from the ItemBP to the Widget, so it will display the Text(Name of the item) that are written in the ItemName variable.

I made an ItemBP reference in the Widget and tried to bind it like that but it always shows error.
I want to create Child Blueprints from the ItemBP and want to change only their Mesh and their name so I don’t need to set up every actor one by one.

How did you set the ItemBP pointer? what error? The pointer must be valid if you want to pull the name from it.