Reputation: 19946
I put my image at /Assets/Test/Textures/Player but without success my code is:
IEnumerator loadTexture(string videotype) {
if(videotype.Equals("3d")) {
WWW www = new WWW("file:///Assets/Meta1/Textures/Player/3D_foucs.png");
yield return www;
texture3D.mainTexture = www.texture;
} else if(videotype.Equals("2d") ){
} else if(videotype.Equals("360")) {
}
}
Upvotes: 0
Views: 4320
Reputation: 10720
Place your png file in Resources folder of your project and load it using:
Texture2D _texture = Resources.Load("3D_foucs.png") as Texture2D;
EDIT :
If you really want to avoid using Resources.Load()
then you can use Application.dataPath
to access assets folder. But make sure you read the docs before that.
P.S : WWW is usually good for loading stuff from outside of project.
E.g from Application's Persistent Data or from web server.
Hope it helps
Upvotes: 1