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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Gather/Collect

Discussion in 'Scripting' started by TheImperial, Jan 19, 2016.

  1. TheImperial

    TheImperial

    Joined:
    Mar 17, 2015
    Posts:
    72
    How to make when Player collides with an object...he stops and a public static value starts Increasing Every second
     
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    Script wise, you will need the static variable, and a boolean that suggests if the player is stopped or not. Then if he is, in the update, just add Time.deltaTime to the value. (assuming that 1 second == 1 unit of movement)
     
  3. TheImperial

    TheImperial

    Joined:
    Mar 17, 2015
    Posts:
    72
    can you give me an Example code
     
  4. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    As much as I can see and do... I need for you to try. Hate to be this way, but it is like asking for someone to do it for you.