Multiple media picker

Options

I tried to follow the guide here, it says on the tip that if we duplicate the media image picker, we can store multiple images, but as I try, seems like when I call the script for image picker - 0, it also calls all of the other media picker aswell, resulting that each media picker contains the same images, and we don't want that.

Or maybe I'm doin it wrong, Please let me know how to do this. Thanks!

Here is the project link: https://we.tl/t-UHD1iNRrX6

Answers

  • Hey, I had just spent a day with similar issue and what I came up with is cloning the texture which was picked from media picker.

    var newSceneObject = global.scene.createSceneObject("ContentItem:img:" + id);
    newSceneObject.setParent(null);

    var image = newSceneObject.createComponent("Component.Image");
    image.addMaterial(script.materialToCopy.clone())

    image.mainMaterial.mainPass.baseTex = img;

    Where materialToCopy is default Unlit material and img is media picked from media image picker.

    Hope it helps :)