Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Cooldown Timer

Discussion in 'Scripting' started by p1zzaman, Jan 1, 2017.

  1. p1zzaman

    p1zzaman

    Joined:
    Jan 1, 2017
    Posts:
    64
    Currently, i implemented a cooldown timer for particular actions. basically I don't want the AI to spam a specific type of action right after it is complete.

    I created my own cool down timer manager which stores a map of action to current timer countdown. And basically it gets called during the Update function of the ai script. I am unsure of the performance of this.

    Is there a native Unity engine time management system that is available? I would think the engine would optimize for such things. Btw, I could be tracking a lot of different timers happening at once.

    Thank you everyone
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    There is nothing like a timer in unity afaik, but in C# there is System.Timers, I'm not sure how well that works in unity, and if it's actually usable in your case, but it's worth a shot