TimeScale = 0 dosent work with this scirpt.

Hello everyone
I am kinda newibe on unity (and my english is not the best for a heads up).

Any way i use this script:
#pragma strict

var newSprites : Sprite[];

var index : int;

var animationSpeed : float = 0.05;

//var timeScaling : float = 1;

var lastTime : float;


function Update()

{

	//Time.timeScale = timeScaling;

	changeSprite();

}



function changeSprite()

{

	GetComponent(SpriteRenderer).sprite = newSprites[index];

	if(Time.realtimeSinceStartup > lastTime + animationSpeed)

	{

		index++;

		index = index % newSprites.Length;

		lastTime = Time.realtimeSinceStartup;

	}

}

i use this script to run my sprites animation.
and in the game when you prees on the pause button the timescale = 0 and everything stops
beside the sprites animaions…
any idea how do i fix it?
Thanks!

You don’t want to use realTimeSinceStartup. This is for timescale independent stuff. Instead use Time.time