How can I link a Widget to a Static Mesh?

Hello everyone,
I wanted to know if it is possible to link a widget to a specific static mesh in the game.
To explain, I made an “Inspect Item” system, which is all into a BP that can contain any of the items I would want to show up: this only BP can be copy-pasted and I would only have to change the Static Mesh attached to multiply and inspect any static mesh in the game.
But, I wanted to also display a widget on top of the Item, to explain the specificity of each mesh inspected.
Roght now, I don’t see how I can make the widget a variable, depending on the item shown.
Here’s the part of the BP where I wanted to add the widgets:

I already made some text variables into the widget, but I can’t figure out how to link that variable so it can depend on the static mesh shown…
I don’t want to turn all of my static meshes into BP’s, since it would kinda ruin all I’ve managed to do since now, but tell me if it’s the only way possible,

Thank you all for your help!
Iness

How bad is it if I make a different BP Inspect for each object to inspect? It would be really heavy on the game right?

I assume you want to give “stats” to a mesh and when the player hovers their mouse over the mesh it should display said stats.

If you want to do something like this you can create a component which can be added to other blueprints. Having it as a component allow you the flexibility to do such a thing. Secondary you need to setup a widget and link the widget variables with the mesh information. This is simply done through the method of getting the variables from the mesh and passing them to the widget. This can be done through casting.

I suggest you create the widget and hide them on startup. When the player gets close you can use a volume to know when to display the widget. This will make it more optimized and make the project run smoothly.

1 Like

Here’s the thing:

I made a BP that can be used with any static mesh that I select: I only have to select the right one as the static mesh component to make it work for all my objects.

It is configured with a static mesh component which is hidden and shows up on key. The great thing with this BP is that the same BP can be used for all the objects in my game,

The only trouble I have is how to make the widget (red drawing) a variable that would depend on the static mesh shown up on the screen: I would have all the widgets configured and only the one related to the static mesh shown would show up on the screen;

I got what you told me, but I don’t really see how to link it up in this way. Could you explain it to me further ? Thank you!!

Keeping the subject up: I still didn’t find an effective way, I hope somebody who knows will be able to help!

Hi there @Nanassxx, hope you’re well!

This topic has been moved from International to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile: