Reputation: 4431
In my game, I get link image from Facebook, and then I use WWW.texture to download an image. But WWW.texture supports only PNG and JPG so I can't load GIF image.
How can I load a GIF file?
Upvotes: 1
Views: 5391
Reputation: 4056
Download to local machine using standard C# WebClient (I'm pretty sure it's supported in MONO):
//.. Imported from System.Net
WebClient client = new WebClient();
client.DownloadFile(@"http://www.facebook.com/superhappyimage.gif",@"C:\image.gif");
Reading GIFs is another issue entirely. You could try a 3rd party lib, Stackoverflow: Animated GIF Library, or you'll need to write your own. I don't recall Unity having GIF reading in its API but maybe that has changed.
Lastly, Unity does not natively support animated images(GIFs). Once you parse the gif you need to write your own custom viewer.
http://answers.unity3d.com/questions/13156/animated-gif-as-a-texture-on-iphone.html
Upvotes: 1