Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity game sleep on hit

public void StartSleep(float duration)
{
  StartCoroutine(HitSleep(duration));
}

IEnumerator HitSleep(float duration)
{
  Time.timescale = 0;
  yield return new WaitForSecondsRealtime(duration);
  Time.timescale = 1;
}
 
PREVIOUS NEXT
Tagged: #unity #game #sleep #hit
ADD COMMENT
Topic
Name
1+1 =