Animated Texture Problem

I’m using an animated texture for the impact the bullets make in my game. There is an animated texture of a molten metal mark that distorts, changes color as it cools and then fades out.

The animated texture is applied to a plane that is instantiated when ray casting detects a hit.

The problem is that the animated texture doesn’t start from the first frame when the plane is instantiated, rather the animation for the texture is invisibly looping constantly and whatever frame it happens to be at when the plane(bullet mark) is instantiated is where the animation starts.
Some bullet marks start in the middle of the animation, some at the end, etc…

Is there a way to make the animated texture start its animation when the plane is instantiated?

BTW, the script for the ray casting is attached to the gun and the script for the animated texture(i got from Wiki) is attached to the plane.

If you’re using a MovieTexture for the animated texture, then calling the Stop just before playing it back should rewind the animation to the beginning.

thanks for the reply. No, not a movie texture-don’t have Unity pro :frowning:

Is there some way to instantiate the material along with the object? Then it might play from the beginning.

How did you get the animated texture to work at all? I created an animated gif from a video file, but it just sits there at the first frame when I put it into a game. I also have Unity Indie.

brad:
I’m using the animated Texture script found on the Wiki here,http://www.unifycommunity.com/wiki/index.php?title=Animating_Tiled_texture

You create a series of images and tell the shader to play through them. The series can have as many images(tiles) as you like, though obviously you’ll get into performance issues the larger the texture size.

To create your texture sheet quickly try using particle accelerator by Leowald, Inconsequence. It takes video files and saves each frame as a tile. You just tell it how many rows and columns there are in your texture sheet and what resolution, etc… It does the rest.

Thanks! Unfortunately the grid width is only 10 x 10 on the Particle Accelerator and that will not work for what I am trying to do (show a short video - approx. 1000 frames). So I guess I am stuck until I can afford Pro.

For your issue, my guess would be that the problem is with the script using delta time to determine which frame to play. This is the time since the beginning of the game, not since the instantiation of the object. I would try replacing that with a simple counter.