Freeze the game for a few frames.

I’m trying to make my game freeze for a small time when i hit an enemy, to give a “impact” feeling, you know?
I tried messing with Time.timescale:

 Time.timeScale = 0.00000000001;
 yield WaitForSeconds (0.001);
 Time.timeScale = 1;

I tried something like this, but the problem is, that, it doesn’t work every time… I’m using a “OnTriggerEnter” function, and the entire function works fine every time i hit the enemy, but this timeScale thing dont… and sometimes it freezes for a long time, and sometimes just for a brief moment, just like i want.

Changing timescale will also have an impact on WaitForSeconds.

The following function

realtimeSinceStartup

however, is not affected. Employ this to keep track of time while timescale is lowered.

TimeScale has very specific effects on Update, deltaTime, FixedUpdate etc and you WILL need to be familiar with this to avoid creating game bugs for yourself.

Research recommended.