Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

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:
    108
    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;