Download

Image swapping on a umg widget

I have a widget with several characters on it for a character selection screen. Some of them are unlocked. Some are not. I have created two separate images (one is full color with the character’s face on it, the other just a silhouette). I have this for each character available. Each character is set as an image on a button for the player to select from (if the character is unlocked). So, my question is, what is the most efficient way to swap out the images if the character is unlocked?

Just change the Texture through Blueprint … this is neither inefficient or efficient … it is just the way it works. 8-}

By default make all the textures the silhouette image and then when the character is unlocked merely call the components Texture node and change it your image.

I guess I should have been more specific. I have attempted to set the default as the “locked” image in the UMG, and call the “unlocked” image when it is unlocked. I tried both as a bind and through the event graph. Neither one worked properly. I also tried setting each image as a slate brush, but that made the button draw as a blank square. How do I set this up properly in the event graph?

Can you share your Blueprint and any other information or visual aids. Because you have mentioned Slate and UMG and I think we are mis-communicating here. 8-{

Sure, no problem. Here are the screenshots from my widget blueprint…
The bind for the image:
498e379d8d2c67420f47f2df7cd8b5144785e4cf.jpeg
8e3c97bd8c569bbfb7fb8696ada783286acf87a1.jpeg
And the widget event graph:


And when tested, it does this:
ef52079f7de0fbabc0b7c98944af15c64d6c4b46.jpeg

That is my current set up. I have also tried linking the locked and unlocked image pins on the struct, but got a similar result.