How to make a timer in Unity | Under 3 minutes |

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025

Комментарии • 37

  • @scordion_x7556
    @scordion_x7556 Год назад +2

    i was searching for a timer 1:00 to 0:00 and for accident made this tutorial
    (thank u anyways, is still usefull :DDD)

  • @ryanstubbs2660
    @ryanstubbs2660 Год назад +2

    THANK YOU PERFECT AND SIMPLE

  • @LeoMattMan
    @LeoMattMan Год назад +1

    Thanks!! This is just what I needed. Works perfectly. Keep up the good work!😁👍

  • @ENDUVY
    @ENDUVY 2 месяца назад

    Short and sweet

  • @j4rka131
    @j4rka131 11 месяцев назад

    Very good tutrial tx

  • @bosflik_7
    @bosflik_7 Год назад +4

    how to stop it and display it as a highscore on the game over screen

  • @harryjilis
    @harryjilis Год назад

    Worked, thankyou

  • @SimpleFischi13
    @SimpleFischi13 Год назад

    Worked, thank you so mutch

  • @Lua_Diurna
    @Lua_Diurna Год назад

    Nice

  • @vladaslittleparadise4402
    @vladaslittleparadise4402 Год назад +3

    1:59 if i want it to do a count down, instead of +=Time.deltaTime i can do - =Time.deltaTime and add a value? Does it work?

    • @banaterkind
      @banaterkind Год назад +1

      -= Time.deltaTime;
      and timeToDisplay -= 1;
      (in Unity TimeRemaining Value from 600 (10minutes) or what you want) now it´s a Countdown

    • @kaitoku2224
      @kaitoku2224 4 месяца назад

      @@banaterkind can you give me the full code bc im having a hard time reversing it

    • @kaitoku2224
      @kaitoku2224 4 месяца назад

      @@banaterkind bc its doing negative time and its not even working

  • @HF_Original
    @HF_Original 3 месяца назад +1

    Hello! Great Video! Is There any way to reset the timer?

  • @PL-pb5op
    @PL-pb5op Год назад +3

    I have an error for last line :
    NullReferenceException: Object reference not set to an instance of an object
    Timer.DisplayTime

    • @adhikari777
      @adhikari777  Год назад +8

      A NullReferenceException occurs when you try to access a member of an object that is null. In this case, it seems like the error is occurring in the DisplayTime method of the Timer script. This could happen if the object that the script is trying to access is not assigned or has been destroyed.
      To fix this issue, you should check if the object that the script is trying to access is assigned in the inspector. If it’s not assigned, you should assign it. If it’s assigned but still causing the error, you should check if the object is being destroyed or if its reference is being lost at some point.
      OR,
      You can try this as an alternative:
      www.mediafire.com/file/4bb987if0uh1qvg/Timer.cs/file

    • @dogebella
      @dogebella Год назад +1

      I assume you forget to drag the timer text object into the timer script in the inspector of unity

  • @kaitoku2224
    @kaitoku2224 4 месяца назад

    I want it reverse countdown how?

  • @josefinaburgos5854
    @josefinaburgos5854 11 месяцев назад

    "Cannot implicity convert type "string" to "TMPro.TMP_Text"
    HELP!!!

  • @mrpotato8196
    @mrpotato8196 Год назад

    Under update? wont it change with fps then?

    • @art_by_ayushadhikari2008
      @art_by_ayushadhikari2008 Год назад

      It works, but nobody would create a game with 20 fps anyway XD. If you encounter issues, you can utilize FixedUpdate though.

  • @MangoesDev
    @MangoesDev Год назад

    thanks

  • @engineering5
    @engineering5 Год назад

    I'm having trouble with the script clipping through objects

    • @adhikari777
      @adhikari777  Год назад +7

      Hi, thanks for watching my video. I'm sorry to hear that you are having trouble with the script. Can you please describe what you mean by clipping through objects?

  • @pizza9240
    @pizza9240 Год назад

    how can I save the timer when I switch a scene?

    • @terrenceryker8541
      @terrenceryker8541 Год назад

      static variables should do the trick. you can trigger the timer to pause when you switch scene. static saves the value while you change scene but not when you restart runtime

  • @anacondra2293
    @anacondra2293 Год назад

    How do I make the timer stop at 5 minutes?

  • @DiptoOg
    @DiptoOg Год назад

    are you bangali?

  • @lamp_pbs
    @lamp_pbs Год назад +1

    bro just give us the script why you gotta be like that mf 😭😭

    • @engineering5
      @engineering5 Год назад

      so u can learn

    • @fidgetcube1935
      @fidgetcube1935 Год назад +1

      ​​@@engineering5 but it's not even the fact of learning, it's time. I have little time to finish this and it's very hard to not have code to copy off of and tweak

    • @adhikari777
      @adhikari777  Год назад +16

      ​@@fidgetcube1935 I understand that you're under time pressure, but copying and tweaking code is not a good practice. It can lead to errors, bugs, and poor performance. It can also prevent you from developing your own skills and creativity. If you want to make a good game, you need to invest some time and effort into learning the basics. My video is meant to help you with that, but you have to do your part too. Trust me, it will pay off in the long run.
      Also, I want to let you know that I will provide the source code for upcoming tutorials, so you can download and study them if you want. But I still encourage you to try to write the code yourself first, before looking at the solution. That way, you will learn more and improve your skills. I hope you enjoy my videos and find them useful. Thank you for your support.

  • @SlimeyDev
    @SlimeyDev Год назад +2

    please provide a link for the code

    • @adhikari777
      @adhikari777  Год назад +1

      www.mediafire.com/file/4bb987if0uh1qvg/Timer.cs/file