- Home /
loading a texture from outside build folder (standalone)
Hi all
I want to create the possibility for my users to put their own images in a "Textures" folder that comes with the game in the root folder. They should fill in the name of their image and press load. The problem is that I don't know how to get the WWW or path to that folder to put it into the WWW.LoadImageIntoTexture.
Thank you for your help
Answer by govi627 · Nov 21, 2013 at 08:45 PM
Try: c# public Texture2D texture;
void Start() { string url = "file://" + Application.dataPath + "/NameOfFolderForTextures/image.png"; WWW www = new WWW(url); yield return www; www.LoadImageIntoTexture(texture); }
Note: Application.datapath is the path to your assets folder in the editor, when you make the Standalone, Application.datapath is the path to your data folder that comes with your .exe
I didn't work that well with c#. could be my fault, I'm not used to it. But anyway I works great with js, thank you very much!