Set Image Widget image using a path string to a texture asset in blueprints

Given that I know the path to a texture asset, how can I set that texture to an image widget using blueprints? I have quite a few images that this could be, so I didn’t want to setup some kind of massive switch, but I am able to construct the path string for the correct texture.

I assume I have to set the brush on the image widget, but I don’t know how to use the path string to retrieve the given asset and turn it into a brush.

EDIT

Ok the Asset Registry doesn’t work when packaged or in standalone. But the data table idea did work from @Arodi007 For anyone interested in how this looks. Here’s what did.

I created a struct that held my info that I want to look up.

Then I created a Data Table using that struct and added rows. The row name is the string which you will construct to lookup the necessary image.

Then I used the table to get the icon and assign it as a brush texture to my image

You can try this way with Asset Registry.
:warning: Important: Just make sure it working on package/ship version as well.

Otherwise you can use data table with soft ref textures list or with data asset.

I’ll give that a try. I read somewhere that the Asset Registry doesn’t work when packaged, so we’ll see. I had thought about doing some kind of data table.

What I’m truly trying to do is display a key mapping icon, but not dependent on the device you’re currently using. So I have some CommonInputBaseControllerData setup that maps out those key/icon relationships. do you know how I might access those given that I know the key I’m looking for?

Ok the Asset Registry doesn’t work when packaged or in standalone. But the data table idea did work from @Arodi007 For anyone interested in how this looks. Here’s what did.

I created a struct that held my info that I want to look up.

Then I created a Data Table using that struct and added rows. The row name is the string which you will construct to lookup the necessary image.

Then I used the table to get the icon and assign it as a brush texture to my image

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.