How can I change the texture of the “stuff you mine” (in the example above: poo/paper/salt/etc) based on the click of the button to the left/right? I have a “Level counter” which adds one to a variable by the click on the right arrow, and subtract one if i click on the left arrow. It makes sense to me that I rename the textures to “1”, “2”, “3”, etc and draw texture “1” when the “Level counter” is on 1, draw texture “2” when the “Level counter” is on 2, etc.
The only question is how can I do that? I found this good solution, but using a branch for every selection sounds a bit over complicating things:
Create a custom Enum in the content browser.
Then use a Switch on Enum to change the variable for the Material or Texture just before the DrawMaterials in HUD.
NB: When you promote the variable off the selection pin on the Switch on Enum, it will be a Byte type.
Change this by deleting it off the graph, going to the new variable in MyBlueprints and changing it to the type you’ve created, ie TextureSwapperEnum. Drag it back onto the graph into the Selection pin. This will then display your choices and not just numbered choices.
If I use Switch on Enum it gives me an exec option to each list item. What I’m looking for is rather an automated version of this, so I do not wish to manually set every texture, but to process a data and automatically select the texture needed, something like this:
1 - get a variable, like the level of the stuff the player can “mine” in the game
2 - feed the variable to ??? (this is where I get stuck)
3 - based on the variable ??? selects a texture
4 - Draw texture based on the selected variable
So basically I need an output that I can feed to the Texture selection in the Draw Texture node
Your solution works, my only problem is I have got like 200+ textures in the game. It would be a massive pain to set up every one of them this way. Like I said, I’m looking for an “automated” solution, where I can draw the texture based on a variable, be it a number or the name of the texture, I dont really mind. Wiring 200+ textures manually sounds too complicated, Im sure there is a simpler solution.