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. Dismiss Notice

Check if player has moved once with character controller

Discussion in 'Editor & General Support' started by mbeal224, Nov 15, 2020.

  1. mbeal224

    mbeal224

    Joined:
    Jul 31, 2020
    Posts:
    20
    I want a timer to start once the player moves and then to stop and restart when you die or beat the level so then start once they move again. How can i check if the player have moved once?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
    If your controls are digital (buttons), then start the timer as soon as you get the first one.

    If your controls are analog (joystick), then decide what constitutes valid input and start the timer then.

    If your game supports both, check in both places, set a "you have moved" boolean to be
    true
    , and then check if that boolean is
    true
    AND the timer is not started, and start the timer.
     
    mbeal224 likes this.
  3. mbeal224

    mbeal224

    Joined:
    Jul 31, 2020
    Posts:
    20
    Thanks!