Search Unity

How to stop first person controller (from standard asssets) move when game over condition?

Discussion in 'Unity Reflect' started by AdamW99, Jan 5, 2021.

  1. AdamW99

    AdamW99

    Joined:
    Nov 10, 2020
    Posts:
    5
    I have a question about first person controller, which i have from standard assets. How can i stop moving this controller after game over condition in my game?
    That is after my health points are 0 i want to stay in one place and cant walk, jump, etc, and next i will set my game-over screen. I think that i must set something in script and function death() but how to do that with fpc controller?

    Thanks for help!
     
  2. DavidMenard

    DavidMenard

    Unity Technologies

    Joined:
    Jun 3, 2019
    Posts:
    121
    Hey Adam,
    This is the forum section for Architecture, Engineering and Construction Industries, so I think your question might be better suited for the General or Scripting sections of the Forums:
    General: https://forum.unity.com/forums/general-discussion.14/
    Scripting: https://forum.unity.com/forums/scripting.12/

    Incidentally, I can also try and help you out :)
    One way of stopping movement after the game ends is to disable the component on your GameObject when the game ends. You'll want to do something like this (this will need to be placed in the right spot & adapted to your code):

    gameObject.GetComponent<PlayerController>().enable = false;