- Home /
Image Sequence in unity without using .gifs for a crowd
Hey there, I'm making a racing game for my University project. Everything is going well, but i heard you can't input gifs into Unity? I want to make one of those old crowd simulations. For example :https://www.youtube.com/watch?v=cCFBwxn92Bc
You can see the back rows are around 5 images put together. I already have the images done, but is there a way to put it in my game? Any starting help would be appreciated, thank you :)
Answer by Augusto Cesar · Jan 14, 2013 at 07:57 PM
Hi, you could simply put these images together in an "atlas" like texture, and scroll your UVs, so if you put the image on a plane, and scroll your texture, you will get the same behavior of a gif.
this is the basic concept, if you need more directions, just tell me, i have made this for a project, and i could give you more directions if you need.
Answer by Sir-Gatlin · Jan 18, 2013 at 08:09 PM
Hey Augusto, Im trying to pretty much make a gif object in unity on a plane, Iv tried using the Textureswapanimator.js found in the wiki but for some reason it wont advance past the first frame. So I was wondering if you could elaborate on your UV concept, being new to unity im guessing you somehow apply multiple textures to an object and somehow write a code that will just switch between them quickly?
var frames : Texture2D[];
var framesPerSecond = 10.0;
function Update () {
var index : int = Time.time * framesPerSecond;
index = index % frames.Length;
renderer.material.mainTexture = frames[index];
}
Sir Gatlin ,
Your code actually works, i think that you are missing assigning the textures into the "frames" array. Put at least 2 imgs, and they will cycle based on the "framesPerSecond" variable.
This example code you posted works,but i have developed another method, that changes the uvs of the texture, and then creates the same effect.
Test if you have assigned all correctly, and post if it works for you, if not i will help you to create this effect based on Uvs.
Huh, Interesting enough I started a whole new project and did a test with this code and it worked fine... I had some 3rd party assets and plug ins and was having some bugs with one of them earlier in the project so maybe something was conflicting. thanks for the quick response and helping me trouble shoot this problem.
Truly Appreciated, G
Your answer
Follow this Question
Related Questions
Animated GIF and Audio Instead of Video? 3 Answers
WbPlayer Loading From File 0 Answers
Image Effects on MovieTexture 0 Answers
Animated GIF as a texture on Iphone 3 Answers
Noob trying to figure out Depth of Field, documentation (edited) 1 Answer