LoadImage weird beahviour

I’m trying to load JPG files and display them with UNityGUI; the jpg file is load ad bytes from a .txt file. Till it runs on Unity on my Mac the image is red and displayed, but when I compile and run the code on my iPhone then a question mark appears instead of the image…

var dspTexture : Texture2D;
var imageTextAsset : TextAsset;


function Start(){
	dspTexture.LoadImage(imageTextAsset.bytes);
}

function OnGUI(){
	GUI.Label(Rect(0,0,480,320),dspTexture);
}

Anyone has an idea why this happens ?

Have you just changed the file suffix of the JPG file to .txt or did you open it with a text editor first? (I guess you probably didn’t but it’s best to check.)

Until we get to the bottom of this, you might be able to do what you want using Resources.Load. You could place an image in the Resources folder and load it at runtime using this function rather than as a TextAsset.