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
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?
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
@@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
@@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.
i was searching for a timer 1:00 to 0:00 and for accident made this tutorial
(thank u anyways, is still usefull :DDD)
THANK YOU PERFECT AND SIMPLE
Thanks!! This is just what I needed. Works perfectly. Keep up the good work!😁👍
Short and sweet
Very good tutrial tx
how to stop it and display it as a highscore on the game over screen
Worked, thankyou
You're welcome!
Worked, thank you so mutch
You're welcome!❤
Nice
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?
-= Time.deltaTime;
and timeToDisplay -= 1;
(in Unity TimeRemaining Value from 600 (10minutes) or what you want) now it´s a Countdown
@@banaterkind can you give me the full code bc im having a hard time reversing it
@@banaterkind bc its doing negative time and its not even working
Hello! Great Video! Is There any way to reset the timer?
I have an error for last line :
NullReferenceException: Object reference not set to an instance of an object
Timer.DisplayTime
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
I assume you forget to drag the timer text object into the timer script in the inspector of unity
I want it reverse countdown how?
"Cannot implicity convert type "string" to "TMPro.TMP_Text"
HELP!!!
Under update? wont it change with fps then?
It works, but nobody would create a game with 20 fps anyway XD. If you encounter issues, you can utilize FixedUpdate though.
thanks
No problem
I'm having trouble with the script clipping through objects
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?
how can I save the timer when I switch a scene?
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
How do I make the timer stop at 5 minutes?
are you bangali?
bro just give us the script why you gotta be like that mf 😭😭
so u can learn
@@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
@@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.
please provide a link for the code
www.mediafire.com/file/4bb987if0uh1qvg/Timer.cs/file