- Home /
Answer by Linus · Oct 21, 2014 at 07:35 AM
You could load from a webpage of from the hardrive http://answers.unity3d.com/questions/14587/load-texture-at-run-time-from-file.html But that has some limitations
If you simply want better organization of the files, the texture does not need to be directly in the Resources folder. You can do Assets\Resources\Textures\Images
or Assets\Images\Resources
All assets that are in a folder named "Resources" anywhere in the Assets folder can be accessed via the Resources.Load functions. Multiple "Resources" folders may exist and when loading objects each will be examined
.
Thanks! I'll try to test the link that you gave me. Actually I'm trying to load images at RunTime :D
Images that the user chooses? Or images that you provide? If user chooses then the answer linked to should be good.
It worked! Thanks!
I made a button "Next" and "Previews" so that I can change the image.
I just need to get the number of images in that folder so that I can change the image with a limitation.
private IEnumerator LoadImages() {
directory = "file://" + Application.dataPath + "/../" + DesktopFolderName + fileName + ".jpg";
WWW www = new WWW(directory);
yield return www;
renderer.material.mainTexture = www.texture;
}
void OnGUI(){
if(GUI.Button(new Rect(0,0,100,40), "Next")){
imageNumber++;
fileName = "image" + imageNumber;
StartCoroutine("LoadImages");
}
}
OR!!! can I store the Images in specific folder in an array?