Hello all, having a few issues with this one, what i’m trying to do is have a single static mesh (a ship) and have multiple textures for that mesh, (currently have 10), when the object spawns in the world it will randomly pick one of the textures, so that each different object has a different look to it (hope that explains it), the type of game i’m making is a turret defense game, so multiple instances of the same mesh are spawned i just want to have them look different when they spawn into the world thank you in advance
Setup your textures like so with If nodes, and use a scalar parameter to switch between them(the node on the left end). Then make it a material instance. And finally pick a random integer for that scalar parameter every time you spawn a ship.
hey, thanks for answering, your mat works well thank you, but one thing, once the object is put into the editor, if i move the object it continuously changes the textures, anyway for it to stay one color once its spawn?
Hey there! Sorry for the delay, I didn’t saw your comment to my answer at first… There is indeed a way, go to your Blueprints Properties, and underneath the category “Blueprint Option”, the first checkbox is “Run Contruction Script on Drag”.
Disable it, and your construction script will run only once placed in the world
hey, thanks for this but when I start doing blueprint like how you did it and after that once the object is put in to the editor its still not changing.
I have made the random texture array global and added different textures through detail panel but its still not working. Do I have to code inside the event graph of blueprint also?
How did you get this to work? I am also having problems and cannot figure out why the texture array does not function. Did you add an actor to the blueprint?
Ok, its late. I was able to get this to work. My mistake was the fact that my elemnt ID did not match to my material element ID. Once I corrected this it now works. The only issue I am having now is that the texture changes when the object is moved. Where would I find the blueprint options to disable “Run Contruction Script on Drag” ?
You can randomize the colors/textures just using one material, what you need is actually make a simple script using the node “per instance random”. Anyway I leave you here a two minutes tutorial where you can learn more about that, and you can see how the randomization work
I hope it could be helpful for you. Good luck with your project