Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

How to load a sprite via WWW on IOS?

$
0
0
Texture 2D temp = new Texture2D(0,0); WWW www = new WWW(pathtofile); //"pathtofile" references to a .png file. yield return www; temp = www.texture; sprite = Sprite.Create(temp, new Rect(0,0,temp.width, temp.height), new Vector2(0.5f,0.5f)); Why this code works on OS X, but it doesn't on IOS? When i try to load this sprite on OS X - it seems ok, but on IOS i see a small question mark. Could someone explain me - why? And this on the other hand works on IOS but is awfully slow: byte[] imgdata = System.IO.File.ReadAllBytes(pathtofile); temp.LoadImage(imgdata); sprite = Sprite.Create(temp, new Rect(0,0,temp.width, temp.height), new Vector2(0.5f,0.5f)); Btw - if i am correct the core of the problem is the texture format - but I have no idea how to work around that. I've also tried www.LoadImageIntoTexture(temp) but to no avail. I have also noticed that the code to load sprite via WWW returns ARGB32 format, but on IOS its RGB24 and the sprite doesn't show. What can I do with this?

Viewing all articles
Browse latest Browse all 4709

Trending Articles