- Home /
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!
Answer by Kiwasi · Oct 23, 2014 at 06:20 PM
You don't want to use realTimeSinceStartup. This is for timescale independent stuff. Instead use Time.time
Thanks for the quick replay and fix! works great now.
Your answer
Follow this Question
Related Questions
Decreasing and increasing a SlowMotion powerup 1 Answer
TimeScale collider, where all the time outside is frozen? 1 Answer
Help with my "speeding up time" script 1 Answer
Time.timeScale = 0 did not prevent click 1 Answer
Pause button 2 Answers