Download

How to get a mesh in a Widget Blueprint

Hello everyone!
I want to change the material of a model (sofa). I have made the widget BP with a few buttons, one per material. I have a button called “BotonVerde” that should change de color (material) of the sofa.
The sofa is a BluePrint Class with a Static Mesh Component and a collision box (to display the menu when overlap)

Here are the names:

Blueprint Class: “SofaColores”
Static Mesh: “Sofa”
Widget Blueprint: “MenuColores”
Button: “BotonVerde”
Material: “Verde”

My problem is that I can´t find the way to get the Sofa in the Widget BP Event Graph to apply the function "Set Material. In this function, I can connect the “Target” only with GetSofa, see the image bellow. When I do this there is another node asking for another Target!! see second image

WidgetBlueprint.jpg

WidgetBlueprint2.jpg

I am really lost with this issue, I guess is very easy to solve, but I don´t find the way.

Here is a image of my BP Class

SofaColoresClass.jpg

Thank you so much!!

Hello,
i did a basic set up in the past which can be a good start : https://forums.unrealengine.com/showthread.php?61302-UMG-buttons-change-material-to-world-grid-material&p=244115&viewfull=1#post244115

Thank you, but I read your message several times and don´t understand the solution.

The point is how to call my static mesh included in the Class from the widget. I hace proved all kind of variables (made in widget BP) like StaticMesh, Actor, class etc, but none of those can link with the “Target” slot in the SetMaterial Function, this is the problem, how to call my mesh from mi Widget BP to apply the function.

In my example, from “array element” output of the loop (or your reference of your blueprint) : drag a wire / right click and type : sofa. From sofa, drag a wire and right click : set material.

At last!!
Oh man, you saved my file :wink: thank you so, so much.
For a unknown issue, I had to delete all the OnClicked because the Loop didn’t caught the sofa target, really I don´t know why. I make all the chain entirely new and boiela! it works!!
I’ve been working on it since last week! thank you so much :wink: