How to randomly change texture of material on tap via scripting.

The effect I want to accomplish is a face tattoo image on the left and right mesh of face. When user taps on icon on screen or taps on screen, the left and right tattoo image randomly changes to a different tattoo image.

I was able to accomplish by creating x number of tattoo image/mesh combinations, then using patch editor, using the random/ math/round, and equals/exactly, then assigning each random number to an image/mesh that triggers its visibility if the random number equals true.

It seems that it would be better and more efficient doing it via a function script. Using a math/random/round that outputs a value that is equal to the index of an array of material/texture that gets assigned to the left and right mesh? I went through the documentation and was able to locate the findFirst plane and material and modify property, ie opacity, but can't locate where I can swap out the texture of a material.

Asked about 5 months ago by Conrad
0 Votes2 FollowersSeen by 1