Loading file on Android during runtime

Hi. I’m trying to load a texture during runtime and I currently have :

WWW www = new WWW( "file://" + Application.dataPath + "/" + filename );
Texture2D t = www.texture;

which works fine on the PC, but it cannot seem to locate the file (it just displays a question mark) when I run it on my android device.

I’ve tried :

WWW www = new WWW( "file://" + Application.dataPath + "/assets/" + filename );

and other variations but it just can’t seem to find it.

(Note : My texture file currently sits in the assets folder.)

With www, always remember yield or isDone

And you cannot access /assets when game is compiled. If all the textures are ready during build time, then you should use Resources folder

And if you want to use DataPath with Android (which I doubt), then see Unity - Manual: Streaming Assets

Thank you very much. I didn’t know about yield or isDone with www and I went the Resources route which worked. Very helpful response!