x


Animated GIF as a texture on Iphone

Is there a way of playing animated GIFs through iPhone Unity?

Converting to a movie as an intermediate format wouldn't be an option unless it could be done on the fly.

more ▼

asked Mar 15, 2010 at 06:45 AM

lowbloodsugar gravatar image

lowbloodsugar
603 26 22 30

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

Aisde from tiling the animation to one texture, you can cycle through individual texture frames:

var frames : Texture2D[]; var framesPerSecond = 10.0;

function Update () { var index : int = Time.time * framesPerSecond; index = index % frames.Length; renderer.material.mainTexture = frames[index]; }

On the more complex end of the spectrum, you can script an animated .gif parser and use actual animated .gif files. For smaller sizes the speed would probably be acceptable.

more ▼

answered Mar 15, 2010 at 02:33 PM

Eric5h5 gravatar image

Eric5h5
111k 55 189 672

Don't know which script is faster / more efficient: Eric's or Joachim's (and here's an Extended version).

Nov 25, 2011 at 03:56 PM Cawas

how come everytime i copy and paste someones script from here i get errors and cant play i did nothing to your script and it wont play im starting to get frustrated nothing seems to work for me

Feb 01, 2012 at 09:31 PM kidrockkenny

@kidrockkenny I'll try to tell this in the (least) sweetest way possible: you're doing it wrong. Now get back to your homework!!

Feb 02, 2012 at 12:58 PM Cawas
(comments are locked)
10|3000 characters needed characters left

Short answer: no. Long answer, you can't play animated gifs, you can play movie textures on iPhone either. So depending on the size of the animation, you'll need to tile the animation to one texture and animate the tiles. Although it's meant for Second Life, it should work for Unity as well: link.

more ▼

answered Mar 15, 2010 at 07:29 AM

Jaap Kreijkamp gravatar image

Jaap Kreijkamp
7k 44 54 99

(comments are locked)
10|3000 characters needed characters left

There is a neat little script in the Unity Wiki that allows to "play" a series of textures without having to put them in a single one. You can also specify how many frames... very clean and effective. BUT you must convert your gif to a Unity readable format.

more ▼

answered Jun 07, 2010 at 10:48 PM

GODLIKE gravatar image

GODLIKE
529 16 16 31

Is there a link with this information in a tutorial please dude?

Nov 11, 2011 at 02:41 AM MightyMatty

That's the script Eric already quoted, made by himself: http://www.unifycommunity.com/wiki/index.php?title=Texture_swap_animator

Nov 25, 2011 at 03:51 PM Cawas
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3587
x2229
x638
x161
x20

asked: Mar 15, 2010 at 06:45 AM

Seen: 13282 times

Last Updated: Feb 02, 2012 at 12:58 PM