Configurable TIMER / STOPWATCH Unity Tutorial

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 69

  • @DavidGonzalez-hf7wx
    @DavidGonzalez-hf7wx 2 роки тому +8

    You're the only one who explains that you have to make a TextManager and attach the script to it so that it lets you drag the Text later on, thank you so much, you saved a brother's day.

  • @stevethepirate
    @stevethepirate 8 місяців тому +1

    dude i never understood how to do that type of if else statement until now! you're the first person i've seen explain that clearly. awesome vid!

  • @mandamoon9149
    @mandamoon9149 2 роки тому +7

    Tick tock, Time to binge watch BMO tutorials. Another good one 👍

  • @esmewilson694
    @esmewilson694 Рік тому +1

    Currently 4am, 12 hours before deadline, and this has reimbursed my mental health to a neautral state and I now can take over the whole. Great tutorial.

  • @Stompin40
    @Stompin40 2 роки тому +13

    This is fantastic. Going to send this to my team to watch. Keep this content coming!

  • @oTbear_
    @oTbear_ Рік тому

    Finally! All the other tutorials were either too long or were outdated. This helped so much ty.

  • @eileeng2492
    @eileeng2492 2 роки тому +5

    Hey BMO, good to see you upload.
    Always learn something.

  • @sandboxgames1461
    @sandboxgames1461 2 роки тому +5

    BMo, I've recently started following you and your amazing! Very clear and well spoken explanations. Please don't stop doing what you do, it's so great!

  • @jakeduncan2721
    @jakeduncan2721 2 роки тому +4

    Another great tutorial from the legend BMo

  • @DekerWin
    @DekerWin 2 роки тому +5

    The tutorial is very good and it works correctly, can you do a tutorial on how to make a timer but with minutes and seconds? I would really appreciate it :D!

  • @adhityagunawan4975
    @adhityagunawan4975 2 роки тому +3

    Cool tutorial 🔥❤

    • @BMoDev
      @BMoDev  2 роки тому

      Appreciate it

  • @headed_weast
    @headed_weast 2 роки тому +2

    Top notch video here.

  • @orfeasliossatos
    @orfeasliossatos 2 роки тому +1

    This is a lovely tutorial, thank you!

  • @tommyyy._
    @tommyyy._ 2 роки тому +3

    How do you make it so that it counts minutes as well please?

  • @frestige_
    @frestige_ 9 місяців тому

    Thank you so much!

  • @ElijahWLYT
    @ElijahWLYT Рік тому

    Really cool stuff

  • @Itsguifi
    @Itsguifi Рік тому

    Thanks, really helpful! :D

  • @andyaguirrez
    @andyaguirrez Рік тому +1

    everything works however the timer does not appear on the screen it only appears once the timer countdowns the number that i put.

  • @catkittycatcatkittycatcat449
    @catkittycatcatkittycatcat449 2 роки тому +1

    how do you make it so that it counts minutes as well? it goes over 60 seconds and idk what the article listed can help with that

  • @secruitgames3588
    @secruitgames3588 Рік тому

    Hey, nice video and usefull since its specific to text mesh pro.

  • @isabela5772
    @isabela5772 Рік тому

    great video but the audio is so low :( i love it but please try to make it louder next time (i put as loud as i could in all my settings and it was still way too quiet to listen)

  • @benjib20
    @benjib20 Місяць тому

    unity won't let me change the format in the way that you did, it says that I can't convert int to string
    help

  • @tridisian8235
    @tridisian8235 Рік тому

    How can I stop timer with OnTriggerEnter (Touching to an object etc. )

  • @chrono9503
    @chrono9503 Рік тому

    How would yo go about pasuing the timer whenever you want as a fuction? I want the time to be displayed at the end of a level

  • @Zyugo
    @Zyugo Рік тому

    How is it possible to change into something that converts to minutes?

  • @anoymos
    @anoymos 2 роки тому +4

    I'm not 100% sure but there's a small issue with the code
    currentTime = countDown ? currentTime -= Time.deltaTime : currentTime += Time.deltaTime;
    This is because you wrote this
    currentTime = currentTime -= Time.deltaTime or currentTime = currentTime += Time.deltaTime
    i think what you meant to do is
    currentTime = countDown ? currentTime - Time.deltaTime : currentTime + Time.deltaTime;

    • @audreyjensen666
      @audreyjensen666 Рік тому

      yeah he is assigning two times unnecessarily.

    • @CathaEdulius
      @CathaEdulius Рік тому

      this fixed the issue I was having thank you!

  • @FoxydoodlesYT
    @FoxydoodlesYT 2 роки тому +1

    I got like 400 errors can you please help

  • @BMoDev
    @BMoDev  2 роки тому +3

    its TIME to subscribe ~~ 😂😂😂😂
    Please do it.

  • @StuxnetExploits
    @StuxnetExploits 2 роки тому

    When I test this out in unity it works perfect, but when I build it as a WEBGL the timer isn't there. Any ideas?

  • @kobaltsteel6418
    @kobaltsteel6418 2 роки тому

    Excellent! I love this! BTW, can this same code be used to... say, keep track of total playtime? Like, say I played a game for 7 hours, 21 minutes, and 45 seconds and I want to display that in the credits... is that possible with this code, or similar code... or will I need something completely different?

    • @casachezdoom2588
      @casachezdoom2588 Рік тому

      You could probably use the script pretty much as-is, start the stopwatch as your game starts, and then at the end of your game do a conversion for the value of currentTime from seconds to HH : MM : SS

  • @itsrashid9760
    @itsrashid9760 Рік тому

    How to slow down this timer ...?

  • @angeluzdracon
    @angeluzdracon 2 роки тому

    por favor , un cronometro en retroceso que marque segundos, minutos y dias y que tras salir del juego se detenga , al igual que cuando se pause. gracias

  • @tommyyy._
    @tommyyy._ 2 роки тому

    My Visual Studio is totally playing with me as it doesnt understand "||" and i cant make limit then.

  • @bobbville
    @bobbville 2 роки тому +1

    🔥🔥🔥🔥

  • @thenecromancer4113
    @thenecromancer4113 2 роки тому

    would anyone happen to know off the top of their head how to format the timer so it goes "Minutes : Seconds"

  • @SanketSharma-vw7dt
    @SanketSharma-vw7dt 2 роки тому

    how to record the time and display it.

  • @unknownid8901
    @unknownid8901 Рік тому

    mine doesnt work for some reason, idk if its because of brackets, the timertext component is not showing up in unity.

    • @BMoDev
      @BMoDev  Рік тому

      If you share your script I can see if theres any issues

  • @williamhiciano394
    @williamhiciano394 2 роки тому

    how do i set it in minutes so every time it gets to 60 it starts showing minutes passed?

  • @hrithikroshansingh3006
    @hrithikroshansingh3006 Рік тому

    thnx chichaaa

  • @kristiyanaleksiev8403
    @kristiyanaleksiev8403 Рік тому

    Decimals: 7:51

  • @skullydev5710
    @skullydev5710 2 роки тому

    Why does this not work for me :(

  • @SomeOne-rw6gz
    @SomeOne-rw6gz 2 роки тому

    Thxx

  • @Lightninz49
    @Lightninz49 2 роки тому

    Can you paste the script in the description or in the comment section? I have having alot of difficuties

    • @benjib20
      @benjib20 Місяць тому

      I have a working version of the script (chatgpt fixed it for me lol)
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class Timer : MonoBehaviour
      {
      [Header("Component")]
      public TextMeshProUGUI timerText;
      [Header("Timer Settings")]
      public float currentTime;
      public bool countDown;
      [Header("Limit Settings")]
      public bool hasLimit;
      public float timerLimit;
      void Update()
      {
      // Updated the currentTime calculation
      currentTime = countDown ? currentTime - Time.deltaTime : currentTime + Time.deltaTime;
      // Fixed the condition checks for hasLimit
      if (hasLimit && ((countDown && currentTime = timerLimit)))
      {
      currentTime = timerLimit;
      SetTimerText();
      timerText.color = Color.red;
      enabled = false;
      }
      SetTimerText();
      }
      private void SetTimerText()
      {
      // Format currentTime to 2 decimal places
      timerText.text = currentTime.ToString("F2");
      }
      }
      (the F2 is the decimal places i think, so if you change it to like F3 it changes the decimal place)

  • @DownTownDK.
    @DownTownDK. 2 роки тому +1

    i dont understand my unity dont like the 11 line??? 3:40

  • @niilokolehmainen7018
    @niilokolehmainen7018 2 роки тому +2

    Unity literally yells at me that I can't convert int to string

    • @benjib20
      @benjib20 Місяць тому

      same here, did you fix it?

    • @benjib20
      @benjib20 Місяць тому

      I have a fix. I think if you change the F2 in the timertext.text at the bottom it changes the decimal places. but this one is on 2
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using TMPro;
      public class Timer : MonoBehaviour
      {
      [Header("Component")]
      public TextMeshProUGUI timerText;
      [Header("Timer Settings")]
      public float currentTime;
      public bool countDown;
      [Header("Limit Settings")]
      public bool hasLimit;
      public float timerLimit;
      void Update()
      {
      // Updated the currentTime calculation
      currentTime = countDown ? currentTime - Time.deltaTime : currentTime + Time.deltaTime;
      // Fixed the condition checks for hasLimit
      if (hasLimit && ((countDown && currentTime = timerLimit)))
      {
      currentTime = timerLimit;
      SetTimerText();
      timerText.color = Color.red;
      enabled = false;
      }
      SetTimerText();
      }
      private void SetTimerText()
      {
      // Format currentTime to 2 decimal places
      timerText.text = currentTime.ToString("F2");
      }
      }

  • @victor36265
    @victor36265 Рік тому

    good, but better with source code

    • @benjib20
      @benjib20 Місяць тому

      do you still need the code? I have it working

    • @benjib20
      @benjib20 Місяць тому

      chatgpt helped lol

  • @ryan7159
    @ryan7159 2 роки тому

    ᵖʳᵒᵐᵒˢᵐ

  • @kitty9140
    @kitty9140 Рік тому

    you're the best