How to Make an In-Game Timer in Unity – Beginner Tutorial

📌 Download the project files from this video: 📌
🎮 Let me know what other topics you want to learn about 🎮
👇 See below for time stamps 👇

4 Hour Twin-Stick Shooter Tutorial –
Formatting the TimeSpan –

0:00 – Introduction and demonstration
1:33 – Unity project setup
2:30 – TimerController.cs Overview
3:58 – Declaring the TimeSpan Variable
6:34 – Setting the TimeSpan Variable
7:00 – Displaying Time to the Screen
7:24 – Formatting our Time Display
10:37 – Final Demonstration and Wrap-up

Please ‘Like’ this video and share it with anyone who is interested in video game development.

Subscribe to the channel for much more independent video game developer related content including tutorials, design breakdowns, industry events, VLOGs, and much more fun stuff!


My Game Development Studio’s Website:

My GitHub:

Music by: Joakim Karud

My Setup:
Camera – Yi Action Cam –
Webcam – Logitech C922x Pro –
27″ 4K Monitor – Asus PG27AQ –
Laptop – Asus GL502VS –
Keyboard – Das Keyboard 4 Ultimate –
Other Keyboard – Ducky One 2 Mini –
Headset – PlayStation Platinum Wireless Headset –

As an Amazon Associate I earn from qualifying purchases.

#CustomEditorWindow #UnityTutorials #GameToolsProgramming


Xem thêm bài viết khác:

14 thoughts on “How to Make an In-Game Timer in Unity – Beginner Tutorial”

  1. Hi i tried to reference the script into my player movement (when i move the timer begin) but i have this error : Object reference not set ton an instance of an object. it's probably sound kinda dumb to you but it's a huge issue for me. Here is the script =
    private TimerController TimerController;  
    private void Awake()
            TimerController = GetComponent<TimerController>();

    private void Update()

    so if u can help me thx 🙂

  2. I've done exactly what is shown in the video, but the timer just stays at zero. And i didn't forget to do StartCoroutine(UpdateTimer());

  3. how could i save the time using playerprefs?….should i set float the current time whenever it passes the time of survival of the last round?

  4. Also I tried playing around with the script but my time starts on 02:35.05 and doesn't move

    Edit: Okay so now I got it on 00:00:00 and it doesn't move

  5. Can I please download the entire project for this game? I'd like to explore and experiment with the game to learn about all the settings

  6. you can literally just put this inside of update:

    elapsedTime += Time.deltaTime;
    Text.text = elapsedTime;

    and you got yourself a timer

  7. Is there a way to convert minutes and seconds back into a float via c#? I was gonna multiply the float times 100 for the score.

  8. it doesnt work for my game, after i started the game, it gets stuck at Time: 00:00.00 and doesnt move. i need help

  9. Im trying to make my timer start when my player walks through a 2d box collider trigger,

    I can get it to pop up but the timer wont start, I cant seem to get the BeginTimer function to be called in another script.

    I dont quite know what im doing wrong, do you have any helpful ideas?


Leave a Comment