Hello ,
I am working on ios 8 and Unity 4.6.2f1 Pro
This piece of code is working on Android flawlessly. I am writing a texture from another method and reading it here. But on ios this doesn't seem to work.
After this output :
Started Loading image from : /var/mobile/Containers/Data/Application/XXXXXXX-XXXXX-XXXX-XXXX-XXXXX/Documents/Portrait/playerPortrait2.jpg
It gets stuck on the while loop waiting for the www request endlessly.
string portraitPath = Path.Combine(Application.persistentDataPath,"Portrait");
string PlayerPortraitImageBigPth = Path.Combine(portraitPath,"playerPortrait.jpg");
WWW fileReq = new WWW("file://" + PlayerPortraitImageBigPth);
playerPortraitBig = new Texture2D(400,400);
if(File.Exists(PlayerPortraitImageBigPth))
{
Texture2D image = new Texture2D(400,400);
Debug.Log ("Started Loading image from : " + PlayerPortraitImageBigPth);
while(!fileReq.isDone)
{
//IT GETS STUCK HERE WHILE WWW LOADING
}
Debug.Log ("Done Loading image from : " + PlayerPortraitImageBigPth);
if(fileReq.isDone){
fileReq.LoadImageIntoTexture(image);
playerPortraitBig = image;
}
else{
Debug.Log ("File read failed. the path looked : " + PlayerPortraitImageBigPth);
playerPortraitBig = null;
}
}
else{
Debug.Log ("Folder failed. the path looked : " + PlayerPortraitImageBigPth);
playerPortraitBig = null;
}
Any help would be great.
BTW i have tried file:// and file:/// with no success. also tried hardcoding the file path directly like :
Application.persistentDataPath + "/Portrait/playerPortrait2.jpg";
↧