DirectoryInfo dir
= new DirectoryInfo
(filePath
); FileInfo[] m_galleryList = dir.GetFiles("*.jpg");
int NumGallery = m_galleryList.GetLength(0);
Debug.Log("You have " + NumGallery + " Movie Files in your Gallery");
foreach (FileInfo f in m_galleryList)
{
string fileName = System.IO.Path.GetFileNameWithoutExtension(f.Name);
string fullFile = ("file:"+f.FullName);
WWW www
= new WWW
(fullFile
);
yield return www;
GalleryUITexture.name = ("tex_"+ fileName);
GalleryUITexture
.material = new Material
(Shader
.Find("Unlit/Transparent Colored")); GalleryUITexture.material.name = ("mat_"+fileName);
GalleryUITexture.material.mainTexture = www.texture;
GalleryTemplate.name = ("gallery_"+fileName);
GameObject galleryObj = NGUITools.AddChild(Grid.gameObject, GalleryTemplate);
galleryObj.name = fileName;
}
Grid.Reposition();