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.

1 Answer

1

I think this might help you.