Тёмный

Make a TIMER & COUNTDOWN in 5 Mins | Unity Tutorial for Beginners 

Rehope Games
Подписаться 10 тыс.
Просмотров 46 тыс.
50% 1

How to make a Timer and Countdown in Unity ?
In this Unity Tutorial we'll maka a timer.
And we'll add the timer to the game.
This Unity Tutorial for Beginners.
Detailed About String Format : learn.microsof...
Enjoy the video ☕
----------------------------
🖐 Hi Game developer
Welcome to Rehope Games I'm Murat
I share unity tutorial videos on my channel. if you want to make a game with unity (especially 2d platformer game), the videos here will definitely interest you.
----------------------------
#unitytutorials, #unity2d, #unity2dplatformer

Опубликовано:

 

29 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 97   
@AMINEI-wl9rk
@AMINEI-wl9rk 5 месяцев назад
using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class timescript : MonoBehaviour { [SerializeField] TextMeshProUGUI timerText; float elapsedTime; void Update() { elapsedTime += Time.deltaTime; int minutes = Mathf.FloorToInt(elapsedTime / 60); int seconds = Mathf.FloorToInt(elapsedTime / 60); timerText.text = string.Format("{0:00}:{1:00", minutes, seconds); } }
@PixelNoob01
@PixelNoob01 5 месяцев назад
Do u know how to add milliseconds?
@AMINEI-wl9rk
@AMINEI-wl9rk 9 дней назад
@@PixelNoob01 using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class timescript : MonoBehaviour { [SerializeField] TextMeshProUGUI timerText; float elapsedTime; void Update() { elapsedTime += Time.deltaTime; int minutes = Mathf.FloorToInt(elapsedTime / 60); int seconds = Mathf.FloorToInt(elapsedTime % 60); timerText.text = string.Format("{0:00}:{1:00", minutes, seconds); } }
@dogebella
@dogebella 9 месяцев назад
good and clear explained. Great work 👍
@RehopeGames
@RehopeGames 9 месяцев назад
Thank you so much 😊
@PixelNoob01
@PixelNoob01 6 месяцев назад
hi, can you pls tell me how to add milliseconds, i cant find it in your link. Would be so happy, tnx.
@RandomDude00001
@RandomDude00001 4 месяца назад
hi how can I add hour?
@Tritonspeedrun
@Tritonspeedrun Год назад
How do I make the timer stop on a certain scene
@RehopeGames
@RehopeGames Год назад
You can stop the time using time scale. Time.timeScale = 0;
@BaldiModsAndroidStudio2
@BaldiModsAndroidStudio2 5 месяцев назад
why did my second move so fast?
@regard2503
@regard2503 5 месяцев назад
you can fix that like this void Update() { if (remainingTime > 0) { remainingTime -= Time.deltaTime; int minutes = Mathf.FloorToInt(remainingTime / 60); int seconds = Mathf.FloorToInt(remainingTime % 60); timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds); } else if (remainingTime < 0) { timerText.text = "00:00"; remainingTime = 0; } } hope it's help you
@JFNIReverse
@JFNIReverse 6 месяцев назад
Too fast instruction. For some reason my Unity report a fault of NullReferenceExeception: Object reference not set to an instance of an object. (Also why did you delete the Void Start when you writing the script?)
@marievoss
@marievoss 6 месяцев назад
Maybe the name of your object has a typo in it.
@RandomDude00001
@RandomDude00001 4 месяца назад
doesnt really matter when you delete Start() its just annoying that its there but blank
@JasonDinh69
@JasonDinh69 2 месяца назад
me too, did you figure out how to fix. Reply fast my game needs this problem fixed
@spacegolbfish
@spacegolbfish 2 месяца назад
I've seen several people use Searilized feild's but for some reason they never seem to work and i tend to have no clue why you'd use it. Does anyone here know?
@JasonDinh69
@JasonDinh69 2 месяца назад
I set up the code for a countdown timer but It keeps giving a NullReferenceExeception: Object reference not set to an instance of an object
@r.f886
@r.f886 9 месяцев назад
Clean and straight to point, thank you very much 👍
@RehopeGames
@RehopeGames 8 месяцев назад
Thanks a lot 🙏
@bcnghia
@bcnghia 10 месяцев назад
I didn't expect my problem to be solved by you again, thank you very much
@RehopeGames
@RehopeGames 10 месяцев назад
Thanks ...🙏
@VerityD2
@VerityD2 2 дня назад
the text is invisble. all i see is a blue square with a t in it
@Tunderpal
@Tunderpal 8 месяцев назад
Is it ok if you could put a copy of your code in the descriptions of your videos? They're all great but it makes it much easier to cross refference.
@bluaurax
@bluaurax 10 месяцев назад
Amazing tutorial dude! Works so perfectly
@RehopeGames
@RehopeGames 9 месяцев назад
Thank you so much 🙏
@SuperMillwall
@SuperMillwall 10 месяцев назад
How would you accelerate the time? For example if you’re playing a football (soccer) game they play 45 mins each half.. But obviously you can’t set the time at 45 minutes real time.. You need it to be 5 mins real time but it needs to speed up in game. Secondly, for a football game, at 45 minutes how do you make the timer stop the game and activate a “Half Time Menu” Thanks for your help. Your videos are so informative and easy to follow.
@RehopeGames
@RehopeGames 10 месяцев назад
You can use Time.timeScale to do that. Look at the unity document for detail. docs.unity3d.com/ScriptReference/Time-timeScale.html I wish success in your project 🙏
@totojatiwijayanto4501
@totojatiwijayanto4501 Год назад
Great and useful stuff. Hi Murat, please make a video that teaches how to create a dialog box. Thanks, hope you doing well
@RehopeGames
@RehopeGames Год назад
Hi 🖐 I noted your request bro. I'm great , Thanks for your interest 😊
@storm_pegasus9659
@storm_pegasus9659 Год назад
Your video is extraordinary and awesome.❤ Can you make videos about game server like Lootlocker or Playfab or Firebase with unity attached? Sorry for my English mistakes. 👍
@RehopeGames
@RehopeGames Год назад
Hi, First thanks for your nice feedback 🙏 I plan publish videos about game server in the future. Actually I don't know Enough English too 😊
@miaalvarez6278
@miaalvarez6278 3 месяца назад
how can i add a button to it to start and stop time
@DJLuigi00
@DJLuigi00 6 дней назад
make*
@ysfgaming861
@ysfgaming861 Год назад
yeni video ne zmn gelir sabırsızlıkla bekliyorum
@RehopeGames
@RehopeGames Год назад
Pazartesi 😉
@ysfgaming861
@ysfgaming861 Год назад
@@RehopeGames abi online nasıl yapılır anlatabilir misin
@brianparnada5077
@brianparnada5077 5 месяцев назад
Thank you❤ I have a request please if possible making a tutorial on how to add extra time in a timer countdown by 2d/3d object is trigger/collide 🥺
@Pokemon4ik2178
@Pokemon4ik2178 6 месяцев назад
Hi Rehope games! Can you make video "how to make a timer before starting a game in Unity" PLEEES
@ELISABETTAIANNONE
@ELISABETTAIANNONE 8 месяцев назад
Dude this tutorial is amazing, thank you!
@RehopeGames
@RehopeGames 8 месяцев назад
Thanks a lot 😊
@詩妍-e2w
@詩妍-e2w 9 месяцев назад
Great tutorial, Thank you so much
@RehopeGames
@RehopeGames 9 месяцев назад
You're very welcome! I'm glad you found it helpful. 😊 Thanks 🙏
@breakdancerQ
@breakdancerQ 6 месяцев назад
Damn good video, got it easy
@BlazeZ__
@BlazeZ__ 5 месяцев назад
Hmm, a bit confused delta time is already in seconds no? Why converting to seconds then?
@abhinavkhatana
@abhinavkhatana Год назад
Thank you for this it will help me to make a speed run game
@RehopeGames
@RehopeGames Год назад
I'm glad to hear that and thanks for your feedback 😊
@abhinavkhatana
@abhinavkhatana Год назад
@@RehopeGames you know that i am watching you since your 2nd video
@RehopeGames
@RehopeGames Год назад
@@abhinavkhatana Thank you so so so much bro 🙏🙏🙏🙏 Is there a special video you want about unity?
@abhinavkhatana
@abhinavkhatana Год назад
@@RehopeGames yes, glad if you will make In both 2d and 3d gun shooting tutorials With variable shooting speed and variable accuracy I've watched others video but I literally do not understand they just say to copy and paste the code
@RehopeGames
@RehopeGames Год назад
Did you want to change the bullet speed or the camera shooting speed ( like slow motion) ?
@SethFX
@SethFX Год назад
Hi, new subscriber, please don’t stop making vídeos
@RehopeGames
@RehopeGames Год назад
Thanks and welcome 🖐
@citrinebby
@citrinebby 10 месяцев назад
you are a lifesaver thank you!!!
@RehopeGames
@RehopeGames 10 месяцев назад
Thanks for your kind feedback 🙏 I'm glad hear that.
@biged606
@biged606 Год назад
Lovely!❤👍🏻😊
@CapZapZap
@CapZapZap 7 месяцев назад
For the countdown ill prefer a couratine method than what you wrote
@minikeanu7535
@minikeanu7535 6 месяцев назад
can you make a tutorial on how i can save the time?
@itierney
@itierney 10 месяцев назад
I'm trying to make a timer that continues in the background on iOS, even if the app looses focus. What solution would you recommend?
@RehopeGames
@RehopeGames 10 месяцев назад
If this for a game, you can use Date methods for this. Date methods + Json file ( for store)
@glimpsygames2734
@glimpsygames2734 Год назад
Holding and pushing a box or a circle tutorial
@RehopeGames
@RehopeGames Год назад
Maybe in the next make a game series 👍
@glimpsygames2734
@glimpsygames2734 Год назад
@@RehopeGames I also post some ideas in my channel
@glimpsygames2734
@glimpsygames2734 Год назад
@@RehopeGames Like swinging and climbing on ropes
@S3V7N_Official
@S3V7N_Official 4 месяца назад
I will remember you in the future
@何文煜-z6i
@何文煜-z6i 7 месяцев назад
Usefulllllllll😍🤩😍🤩and easy
@RehopeGames
@RehopeGames 7 месяцев назад
Thanks a lot 😊
@Ogamer320
@Ogamer320 3 месяца назад
thanks really great tutorial
@slob5041
@slob5041 2 месяца назад
I like the timer text
@fustream8526
@fustream8526 Год назад
Hi, can you make a tutorial on how to show silhouettes when hidden? Thank you very much.
@RehopeGames
@RehopeGames Год назад
Hello ,You can, too 😊 First, create a silhouette image of the character, then change the character lmage to you've created lmage when the character hidden.
@allawigamer7449
@allawigamer7449 Год назад
please can you make video about how to add settings menu for graphic
@RehopeGames
@RehopeGames Год назад
Graphic quality etc. ?
@allawigamer7449
@allawigamer7449 Год назад
@@RehopeGames yes please
@FlashProUA
@FlashProUA 3 месяца назад
Thanks!
@ahmedsachwani2868
@ahmedsachwani2868 10 месяцев назад
So I am making a project where I am using a panel in 3 different scenes using singleton, now I need to show the timer on the panel when the game ends. Problem is the timer starts AFTER the game ends.
@RehopeGames
@RehopeGames 9 месяцев назад
Hello Sorry for the late reply. I hope you solve it. If you have a script that is not a singleton and exists in every scene, you can access the Timer from that script and start the timer from within the Start function
@ahmedsachwani2868
@ahmedsachwani2868 9 месяцев назад
@@RehopeGames yeah, my partner who’s making project with me helped solve it. Also instead of using string format, we used TimeSpan
@RehopeGames
@RehopeGames 9 месяцев назад
@@ahmedsachwani2868 👍
@erikfelde1399
@erikfelde1399 5 месяцев назад
Thank you ❤
@baikaewnutkamol986
@baikaewnutkamol986 7 месяцев назад
How can I keep the timer running in every scene?
@adamktaylor
@adamktaylor 2 месяца назад
Hopefully you've figured it out already, but I'm thinking maybe a DontDestroyonLoad attached to the timer itself and the text/GUI associated with it?
@Rccustomoffroad
@Rccustomoffroad Год назад
Hey, how i put the lose game when the time go to0?
@RehopeGames
@RehopeGames Год назад
Hello , I showed this in the video
@mapbot4264
@mapbot4264 Год назад
how to make the timer reset when gameover/restarting please reply
@RehopeGames
@RehopeGames Год назад
remainingTime = 0; 😊
@mapbot4264
@mapbot4264 Год назад
@@RehopeGames where do i add that to the code??
@Galaxy_World
@Galaxy_World 5 месяцев назад
​@@mapbot4264add it to the area where your code tells the game your player died
@rike6771
@rike6771 10 месяцев назад
How do you pause it?
@RehopeGames
@RehopeGames 9 месяцев назад
You can use -Time.timeScale- to do that.
@toantran3747
@toantran3747 Год назад
Line Renderer please
@RehopeGames
@RehopeGames Год назад
👍
Далее
How make SWIPE LEVEL MENU in Unity?
13:33
Просмотров 21 тыс.
I Paid Fiverr Game Developers to Make the Same Game
10:25
The Most Impressive Scratch Projects
11:00
Просмотров 4,9 млн
Configurable TIMER / STOPWATCH Unity Tutorial
11:08
Просмотров 35 тыс.
Best FREE Software for Game Development in (2024)
8:01
How To Make a Countdown Timer in Unity
12:33
Просмотров 64 тыс.
Why Solo Developers Should Use Unreal
9:51
Просмотров 386 тыс.
10 Unity Tips You (Probably) Didn't Know About
6:47
Просмотров 42 тыс.