Creating a Countdown Timer in Unity

Поділитися
Вставка
  • Опубліковано 28 вер 2024
  • n this Unity tutorial video I would like to show you how to create a countdown timer.
    The value for how long the timer is counting backwards, can be set in the Inspectors panel. The technique, which is shown in this tutorial, can be used for pausing a game after an amount of time.
    Some scripting knowledge is required for this course, and I recommend that you check the intro to scripting tutorials before taking this lesson.
    An example use would be a section in your game, where you have one minute to collect 10 goodies.

КОМЕНТАРІ • 12

  • @Godmil
    @Godmil 10 років тому +1

    Quick formatting correction hack:
    if(seconds < 10)
    { textTime = String.Format("{0}:0{1}", minutes, seconds); }
    else
    { textTime = String.Format("{0}:{1}", minutes, seconds); }

  • @cynnidc
    @cynnidc 9 років тому

    Thank you for your tutorial! But I have a question. How can you add time to the timer when you click on something?

  • @pescator
    @pescator 8 років тому

    What is the symbol at line 18 before 60 at minute 13:37 ?

  • @marceloblanc6763
    @marceloblanc6763 10 років тому

    In standard C# this code should work without an if.
    textTime = String.Format("{0}:{1:00}", minutes, seconds);

  • @Zephemus
    @Zephemus 10 років тому

    Thanks for making this, I'm actually working on a school project that runs on a timer of 10mintues, just going to have to convert this code to C#.

  • @jackg634
    @jackg634 10 років тому

    Thanks. Great tutorial! I was looking for this for days.

  • @b3daz
    @b3daz 10 років тому +1

    You should zoom the text.

    • @مهديالشريفي-و2ب
      @مهديالشريفي-و2ب 8 років тому

      +Akira_san
      indeed.
      Either zoom or attach the file in the description.
      I am barely able to follow

  • @saasjeavenue
    @saasjeavenue 9 років тому

    does this code also work with unity 4.6 and on a canvas?

  • @kevinchen152
    @kevinchen152 10 років тому

    Whats the thing that looks like 66 or " before the word minute in line 24?