Search Unity

How do i make the game freeze on collision

Discussion in 'Getting Started' started by puffyjoe7, Dec 22, 2022.

  1. puffyjoe7

    puffyjoe7

    Joined:
    Aug 9, 2020
    Posts:
    4
    im trying to make a game where when you collide on an object the game freezes
     
  2. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
    Dude, are you serious? 5s in Google.



    In 25s I see that it is enough to set e.g. time scale to 0. I don't know how to make time scale to zero? Unity manual https://docs.unity3d.com/ScriptReference/Time-timeScale.html.

    So now I must only detect collision and set in method
    Code (CSharp):
    1. Time.timeScale = 0.0f;
    And I'm not playing omniscient here, I didn't know it myself a minute ago.