- Home /
timeScale doesn't work
Hi, this is my code that use it on the buildings
using UnityEngine; using System.Collections;
public class oblisk : MonoBehaviour {
public GameObject building_Obj; public Camera cam; public Camera camMain; public ParticleEmitter exp; // Use this for initialization void Start () { cam.enabled=false; exp.enabled=false; }
// Update is called once per frame void Update () { if(building_Obj.animation.IsPlaying("f2")) { Time.timeScale = 0.1F; exp.enabled=true; camMain.enabled=false; cam.enabled=true;
}
else
{
Time.timeScale = 1.0F;
Time.fixedDeltaTime = 0.02F * Time.timeScale;
cam.enabled=false;
camMain.enabled=true;
exp.enabled=false;
}
}
void OnTriggerStay(Collider other) {
if(other.tag=="Player")
{
if((agatScore.agatScoreNumber==1)&&(Input.GetKeyDown(KeyCode.E)))
{
building_Obj.animation.wrapMode=WrapMode.Once;
building_Obj.animation.PlayQueued("f2",QueueMode.PlayNow);
agatScore.agatScoreNumber=0;
}
}
}
}
now, after OnTriggerStay all thing is correct means camera changed, building destroy animation played, timeScale changed and ...
but every thing is ok just for once not more, means every thing is ok except timeScale, its not change for second time building destroy animation thanks so much
Your answer

Follow this Question
Related Questions
Altering Fixed Timestep when your game is running to allow for smooth low Timescale animation. 2 Answers
Physics + BulletTime = problems 1 Answer
change timescale for a specific gameobject 0 Answers
Level completed but still playable (timescale problem) 0 Answers
How to return unity back to its normal time scale and fixedDeltaTime 0 Answers