www returns gif . How to convert it to texture2d in Unity3d for Android?

I have been trying to get a gif image from the network in Unity. But using www.texture returns a big red question mark on the plane. .gif rendering is not supported in Unity.

What is the correct way to do it? How to use the parser for this? I don’t know what my server will return. It may return a png or a gif file.

did you try the suggestion from stackoverflow?

@gjf Yes I did. Most of them recommended me to use plugins. I guess its possible to make a parser myself. I would prefer looking into Texture2D class.

1 Answer

1

If your server can return gif files, then you will need to implement your own GIF reading code, and use the pixel processing members of the Texture2D class. (It’ll be easier to just set up your server to only return pngs.)

I guess it is not possible from server end so can you explain "pixel processing members of Texture2D class".

However I came across this code wiki.unity3d.com/index.php/AnimatedGifDrawer but problem with this is System.Drawing.dll does not compile for android platforms as it throws exception.