Read Images for buttons on Blueprint instance

I have an array of images on my blueprint with 3 images.

In the images below of my UI I have hardcoded the images on to the buttons.

How do I make my UI read those 3 images from the blueprint instance, so I can have many different blueprint instances with different images attached?

Hello again :slight_smile:

You could make an image array property on the widget (make it exposed on Spawn) and then pass in the image array on your blueprints into the widget.

In the widgets event construct, you can set the images in the widgets to those in the property.

It’s a style of UMG button:

334202-screenshot-1.png

Roger, roger. So what GrumbleBunny suggested could look similar to this:

Just ensure the texture array has enough elements. Otherwise the editor will have a really bad time.

Alternatively, you can assign them 1 by 1 without the loop, which is fine if you have 3; but not so fine if you have 30…

That would be ideal, but I am not sure how I access my widget from my blueprint? Right now I cannot figure out how to even make a function on my buttons image. It looks like I have to make a separate image and then make a button on that?

I keep seeing this image on the forums, but I have no earthly idea on how to get that to show in my blueprint. Do you know?

If i drag from the button pin and type “target” i get nothing. But how do you access it?

cross that I found it. Ill continue to work on this. Thank you! !

Or if you want to get really fancy, make a widget that is a single button, that has an image property. Then in your choices widget, loop over the images and make a button for each one.

Thats looking really good, but how do I feed in the actual textures into the widgetBlueprint from the gameMechanic blueprint, was more my question?

Via a Custom Event is one way:

So the widget can be later on updated like so:

Strange how that “pass by reference” feels so hidden. Its seriously mega powerful to make meaningful instance blueprints.

Is there a way to reach the widget without using the “Create New widget” as I am already doing that in C++?

Try using NewObject() ?

It worked using the Get Widget By Class! Awesome!