It is possible to randomize textures on a static mesh taking random image from an external folder?
I need help to know if it is possible to make the faces of the cube change randomly with random textures from a selected folder of the pc using the blueprints.
when I press the buttons on the top left the faces will be changing in random textures.
thank you for your attention!
To make it random you could get all filenames with a given extension from a folder and put these into an array. From which you then randomly pick one.
The Rama plugin also contains a function that can do that for you:
I personally only tested the get files at runtime, but I don’t see why the Load Texture wouldn’t work aswell.
ok, and is it possible to change texture in-game in real-time?
ex. I take a photo > the photo is stored in a folder > the image will appear by pressing the button automatically in real-time
Here I made a working example using a cube. (specify the correct folder for your pictures)
Then simply call the ApplyRandomTextureFromFolder function with the material index you want to change.
I would set this up in the actor that you want to change textures on. And call the function from the UI.
ok… last question XD
where do I put these nodes?
I’m trying to put them on the button and nothing change
Glad it worked, please accept the answer if this resolved your problem!
I tried to replicate your blueprint but with a button of a widget but nothing happens… it says that it failed in step 2
That would mean there are no files with the extension “.png” in the folder you provided, since the length of the array is 0.
I also see I did Length - 1 , this is not needed when using Random Integer. Since it gives a number from 0 to max -1. So you’d want to remove that.
Ok! now it’s working!!
I removed the -1 integer and Inoticed the first node was wrong, I put the JOY FILE IO GET FILES instead of JOY FILE IO GET FILES AND ALL SUB FOLDERS
Thank you so much!! ^^