how to pause my game for 2 seconds and resume the game , in oncollisionenter
You set Time.scale to zero (0) and after the three seconds you can set it back to the old value. Keep in mind that coroutines wont work with that, as they are as far as I know dependednt of the Time.scale value.
You can overcome this barrier by using a different mechanism to check the elapsed time. For example using Update to check Unity - Scripting API: Time.realtimeSinceStartup to calculate the elapsed time.
Coroutines work the same as Update, except they get called after Update is finished. You can use the same technique as you would in Update in a Coroutine.
Ok, this is correct. My point on coroutines was only relevant for yield WaitForSeconds.
Thank you Marrrk and Danielquick ,its helps me…