Hello, I’m Currently writing a software that download images from the internet and saves them to disk for future use (I can give the code if its needed). Thing is, in memory these files look good, I open them with another software and they look complete; However using unity’s LoadImage function, the image is loaded partially (img attached) it happens to every image that is loaded.
I would appreciate some help as i’ve been in this problem from quite some while.
public IEnumerator Reloading(){
Texture2D texture = new Texture2D(2, 2);
for (int i = 0; i<q.Count;i++){
QuestionImages.Add(new List<Sprite>());
for(int j=0; j<q[i].photoURL.Count;j++){
print("jr");
QuestionImages[i].Add(Sprite.Create(new Texture2D(2,2), new Rect(0,0, 2, 2), Vector2.one/2));
UnityEngine.ImageConversion.LoadImage(texture, loadimage(i,j));
yield return new WaitForSeconds(1f);
hello.sprite = Sprite.Create(texture, new Rect(0,0, texture.width, texture.height), Vector2.one/2);
QuestionImages[i][j] = Sprite.Create(texture, new Rect(0,0, texture.width, texture.height), Vector2.one/2);
}
}
}
public byte[] loadimage(int x, int y)
{
byte[] bar = File.ReadAllBytes(Application.dataPath + "/photos/img" + x + "_" + y + ".png");
return bar;
}
