- Home /
How to Stop running after a few Seconds ?
I need Help , i want press left ctrl and then the player should get more speed and after 8 secs he should walk normally.Can any one help me pls ?
My Script :
function Update () {
if (Input.GetKeyDown("left ctrl")) {
Time.timeScale = 3.0;
}
}
That's definitely a bad way to achieve this! Increasing timeScale makes everything run faster, including the time. Unless you want a fast-forward effect, this should be avoided. Tell us what is your player (CharacterController, Rigidbody, simple object etc.) so that we can show you a better way to get the intended result.
Answer by wilco64256 · Sep 16, 2012 at 05:02 PM
Whatever you're using to control the speed of your actual character object, THAT is what you should be changing the speed on and not the timescale. It would be much easier to immediately modify that speed, and then use an
`Invoke("Slowdown", 8);`
which would then contain some code which changes the speed back to normal.