How can I replicate a "function" using as input a widget ?

Good evening !

My issue is quite simple : I have 10 statues, I want that each time I click on a statue, it displays a widget as above :

It is a very simple code that displays the widget if it hasn’t appeared yet.

My question please: how can I create a custom event for every statue that will just receive as input the name of the widget to be displayed ? Each statue has its own widget, and I don’t have the courage to write this code for every statue …

Hey @KALRYSSIAN!

So I have a question.
Are the statues all the same BP/are there any that are the same BP and just copies?

You can right click Create Widget Indice 1 Widget 's class pin and Promote to variable. Then you can set that variable to be whatever you want.

If they’re all the SAME BP but multiple instances, click the eyeball next to the variable in the variables list to make it public, then compile and save. Now you can go into your level and set each one individually! :slight_smile:

If you have any questions, please ask, and bring screenshots! :slight_smile: We’re here for ya!

Hello and thank you for the fast answer !

They are different statues, for example if you clic on one it will display “This is a representation of modern art”, and if you click on another one, different shape, it could display “This is obvisously alien art” … The difficulty is that in the BP i showed you, i have to create variables of the widget displayed, so it would take a lifetime to do that for every widget…

My objective : to go to the BP of a statue and call a function and link to it the name of the widget I want to display : i will create all the widgets, then call them with one function accepting that widget as argument

Ah! So you can just use the exact same BP 12 times instead of individual BPs for each statue.

First, you’ll do as I said above and right click → Promote to variable on the class in your “Create Widget” node. Name it whatever you’d like, but this will change for each statue. In the variables window, open the eye icon on the variable, this will make it “Instance editable”. This means for each one in your level, you can CHANGE this.

You will also find your “Static Mesh” variable, and open the eye for that as well. This way you can change the look of your individual statue in the game.

Now you’ll place all 12 statues, and for each one, in the details window on your level browser, you’ll have dropdowns to change out each one’s widget and static mesh individually. This way:
1 BP
12 statues all with different looks and widgets! :slight_smile:

Hum… I am afraid you think I am a genius like you … which I am clearly not …

May I ask please some screenshots ? :slight_smile:

I mean, I have created the variable for the mesh and the widget, but after that i have compilation error, I don’t know where to change the value of the widget :frowning: