LoadImageIntoTexture on iPhone from the device disk

Hello all,

I am loading a texture from the iphone disk but I am always getting a question mark or black texture. On the editor works perfect. Here is my code:

WWW www = new WWW("file://" + ConfigGame.GetiPhoneDocumentsPath() + "/ExtraLevels/World3/WorldSelectionWorld4.png");
    m_TextureWorld[3] = new Texture2D(256, 256, TextureFormat.RGB24, false);

What am I doing wrong? The texture is a png and in RGB24 and everything just looks fine!!

You need to wait for the download to complete -- even though the file is on your local disk, there is still time involved to access the file system and load the texture, and the WWW class goes through its normal asynchronous operations.

You should run the code fragment above in a coroutine, and "yield www;" to wait for it to finish.

See the docs for more info.