How can i show the Texture2D ?

My codes;

string textureA = "Assets/Resources/box.png";
Texture2D inputTextureA = (Texture2D)Resources.LoadAssetAtPath (textureA, typeof(Texture2D));

GUI.DrawTexture (new Rect (Screen.height / 3.0f, Screen.width / 16.1f, Screen.height / 10.1f), inputTextureA);

Texture appear in my unity project, but when i build it to apk, doesnt appear in my android phone. I tried all texture types but no result. What i have to do ? Thnx.

A big clue:

1877053--120679--Screen Shot 2014-12-07 at 1.55.11 PM.png

You can’t use editor-only functions in a build. Also the Resources folder does not exist in a build; all assets are compiled into a file. You can use Resources.Load.

–Eric

1 Like