- Home /
Question by
EBR · Apr 22, 2013 at 02:27 PM ·
timedelayslowmotion
How can I add a "delay" before switching back to realtime? (Read description for more detail, sorry)
Hi Everyone!
Sorry if I am being an idiot, I am very new to unity and scripting. I was wondering if it was possible to press a button and then make it go in to slow motion for 5 seconds then after the "delay" go back to normal speed. This is what I have so far:
//SLOW MOTION
if (Input.GetButtonDown("Sprint"))
{
Time.timeScale = 0.1f;
Time.fixedDeltaTime = 0.02f * Time.timeScale;
//5 seconds later...
Time.timeScale = 1f;
Time.fixedDeltaTime = 0.02f *Time.timeScale;
}
Sorry for any inconvenience and thank you in advance.
Comment
Your answer
Follow this Question
Related Questions
how to slow down speed increase? 2 Answers
Time Function in Javascript? 1 Answer
Make Raycast shot the ray slower? 1 Answer
What's the best way to ramp slowmotion? 1 Answer
Time Delay Animation 1 Answer