I’m making a configurator where you can place different kinds of furniture, and if you click the furniture a widget pops up with buttons to change material and color of that actors static mesh. Right now it can only get the first clicked actor though, because I’m using “Get all actors of class” and then I left the index at 0.
So I need something that sets the last clicked actor or mesh and gets that when the buttons are pressed. I just don’t know how to do it because I don’t understand how variables work in relation to actors.
Sure. I’ve tried two different solutions here, but in both cases only the first clicked actor has its material changed. The variable LastClicked is a mesh that is set after clicking a mesh.
I tried doing this but there are a few things I don’t get.
How do you make a custom event with the variable “show” attached?
What is “New widget blueprint” in this case?
What is button 42 in this case? I mean, the buttons are called from the widget blueprint. I don’t see why you need to do anything with them here, except for the left mouse button that is used to show the widget.
When I try to attach the “OnClickedEvent_0” to the BindEvent node it tells me that "Delegate is not compatible with delegate(by ref).
You can create Custom Events by right clicking anywhere in the graph and searching for it:
Once the node is selected, it can be renamed and new inputs added:
What is “New widget blueprint” in this case?
It’s the class of the widget that we are showing. You probably have a better name for this. Configuration Widget I presume. It’s the widget that shows how this piece of furniture can be modified.
What is button 42 in this case? I mean, the buttons are called from the widget blueprint. I don’t see why you need to do anything with them here, except for the left mouse button that is used to show the widget.
Button 42 is an example of pressing a button in widget and triggering an execution in the actor that owns it. You were doing this:
Which will never work if you have more than 1 object. In my example, each furniture BP has its own widget and pressing its button tells the furniture BP that something was clicked. So we can easily change the material directly in the actor: