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 Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    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:
    103
    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;