Programatically set image object from assets
Hello,
I would like to have 100s of images inside my lens library and programatically pick a random one to display.
I know one way would be to create 100 image properties and manually set each asset on the UI.
But is there a way to programatically set the asset name 100% via code without having to manually map things?
Like I would like to do
imageObject.mainPass.baseTex = "image25.png"
isntead of making 100
// @input Asset.Texture texture1
.
.
.
.
.
// @input Asset.Texture texture100
imageObject.mainPass.baseTex = texture25
Hi Marco,
When the resource picker pop up window shows up, you can multi-select your images, and it will add them all into the array.
To do this, select the first file, and then shift+click the last file and it will select all the files in between. Alternatively, you cant cmd+click to multi-select files that are not next to each other.
Let me know if you need clarification.
Can't wait to see what you come up with!
Cheers,
Jonathan
Thanks Jonathan.
That will save a lot of time next time.
I’ve used this for my lens “ur celeb twin” under my username @viralstuff and the lens is showing up in the trending section with over 1 mi views 🤗