Make Gallery from Array

Hi, I would like to have a folder that I can specify from string (I kind of know how to do this so far.) But I would like an array, and any, say: Movies or images - that go into the folder go into the array, and it can let you view them with the video texture feature…

How would I go about starting something like this?


You can use classes from System.IO namespaces to achieve what you want. To get array of file paths, use Directory.GetFiles method. Having these paths, you can load the images/videos with WWW class, and access texture using WWW.texture or

Now the sad part… Remember, that Unity can only load PNG/JPG images and Ogg Theora videos. If you want to support other image formats, e.g. BMP, you’d have to convert them on the fly to one of Unity supported formats. You’d need a custom solution for this though. For example, you can use System.Drawing.Bitmap, but only if you target Windows (and possibly Mac/Linux - never tried it).

I know of no easy way to handle other video formats though. Transcoding on the fly would be impossible in real time, so I think the only solution is to use a MovieTexture alternative, if you find any…