Change textures when press key 1 2 or 3?

So I have an instanced material where the base colour texture is with a parameter 2D.

The intention is to be able to press 1 2 or 3 and then this switches the texture to a different texture named 1, 2 or 3.

I’ve got this far with my blueprint, but I don’t know how to change the “Set texture Parameter” Value node to the different textures based on what key I’ve pressed?

Any pointers?

As long as the material you are trying to change has the parameter ‘switcher’, then you will want to set the texture on each key press, instead of the ‘Begin Play’.

There is a ‘Value’ node on the Set Texture function, clicking this drop down will show a list of textures you have available to use.

You mean like this?

Is there a more elegant way to do this if I scaled it up?

Ie I have textures called 01.png, 02.png, 03.png…50.png, show the texture whose name corresponds to the number keys pressed?
Could I do it with an array of textures or something? I guess how do I convert a number input into a texture named as a number?

For input you will have to create some method to read each keys and store them in a variable.
But for the multiple amount of textures, look at using a map with the key as an integer and the value as a texture.

That way, you can have as many textures linked to a number as you want. Then when you want a texture, use the map with the key to find your given texture.

" key as an integer and the value as a texture."

This is the bit I’m struggling with. Could you post a blueprint example of how to take an integer value and convert it to a texture name of that same integer?

I don’t know what nodes to go about dealing with this.

Thanks for all the help! Really appreciate it.