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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Custom Timer [1.0 RELEASED]

Discussion in 'Assets and Asset Store' started by 00Sage00, Jan 13, 2018.

  1. 00Sage00

    00Sage00

    Joined:
    Jan 18, 2016
    Posts:
    1
    Hey everyone!

    Check out my newly released Custom Timer package, easy-to-use and ready to implement in any project. Get a customizable timer working in your project within minutes.

    Here's a link for the asset store.






    Includes 20 Ready to Use Prefabs

    Includes Easy, In-depth Customization Options


    Includes 9 Public Functions:
    StartTimer()
    PauseTimer()
    ResetTimer()
    RestartTimer()
    DisableTimer()
    DestroyTimer()
    ReverseCountDirection()
    ReverseFillDirection()
    GetTimerValue()

    Includes Timer End Event

    Includes Extensive Documentation




    Any and all suggestions, ideas, or questions are welcome. I hope to update this asset with requested features/improvements!

    Thank you!
     
    Andreas12345 likes this.
  2. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    523
    Hello,
    wit the Timer End () function can i add another timer for start?
    I like to make an interval timer for sports. With warmup cooldown short efforts intervals.
     
  3. Rmed777

    Rmed777

    Joined:
    Mar 15, 2014
    Posts:
    9
    Hello,
    Is the timer good with Unity 2019. And I need it to count down by minutes and seconds showing together. Such as 5:00 minutes counting down 1 second and time, which would then show 4:59 or 4minutes and 59seconds and so on. In all the samples each timer appears to be showing only seconds. I didn't notice any that were showing minutes and seconds together.

    I don't need any of the graphic animations just a straight minute and second display timer.
    Thanks,
    Rick
     
  4. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    523
    The dev never response to me, but you can:
    Code (CSharp):
    1.  public bool minutes;
    2.         [Tooltip("Show or hide Minutes:Seconds decimals")]
    3.  
    Code (CSharp):
    1.     //Minutes to show
    2.             if (m_timerTextSettings.minutes)
    3.             {
    4.  
    5.                 int minutes = Mathf.FloorToInt(duration / 60F);
    6.                 int seconds = Mathf.FloorToInt(duration - minutes * 60);
    7.                 //string duration = string.Format("{0:0}:{1:00}", minutes, seconds);
    8.                 m_timerTextSettings.textObject.text = string.Format("{0:0}:{1:00}", minutes, seconds);
    9.             }
    10.  
    Code (CSharp):
    1.  switch (countUpOrDown)
    2.         {
    3.             case CountUpOrDown.countUp:
    4.  
    5.                 if (m_timerTextSettings.milliseconds)
    6.                 {
    7.                     m_timerTextSettings.textObject.text = curTime.ToString("F2");
    8.                 }
    9.                 if (m_timerTextSettings.minutes)
    10.                 {
    11.                     int minutes = Mathf.FloorToInt(curTime / 60F);
    12.                     int seconds = Mathf.FloorToInt(curTime - minutes * 60);
    13.                     //string duration = string.Format("{0:0}:{1:00}", minutes, seconds);
    14.                     m_timerTextSettings.textObject.text = string.Format("{0:0}:{1:00}", minutes, seconds);
    15.                 }
    16.                 else
    17.                 {
    18.                     m_timerTextSettings.textObject.text = curTime.ToString("F0");
    19.                 }
    20.                 break;
    21.  
    22.             case CountUpOrDown.countDown:
    23.  
    24.                 if (m_timerTextSettings.milliseconds)
    25.                 {
    26.                     m_timerTextSettings.textObject.text = (duration - curTime).ToString("F2");
    27.                 }
    28.                 if (m_timerTextSettings.minutes)
    29.                 {
    30.                     int minutes = Mathf.FloorToInt((duration - curTime) / 60F);
    31.                     int seconds = Mathf.FloorToInt((duration - curTime) - minutes * 60);
    32.                     //string duration = string.Format("{0:0}:{1:00}", minutes, seconds);
    33.                     m_timerTextSettings.textObject.text = string.Format("{0:0}:{1:00}", minutes, seconds);
    34.                 }
    35.                 else
    36.                 {
    37.                     m_timerTextSettings.textObject.text = (duration - curTime).ToString("F0");
    38.                 }
    39.                 break;
    40.         }
    41.     }
    42.