How to Track Time in Unity

Unity

Let's set up Unity to count how much time you spend making games!

Step 1: Make a Hackatime Account

Go to Hackatime and make an account. Then log in.

Step 2: Get Your Settings Ready

Click this link to the setup page. It will set up your account so it works with Unity.

Step 3: Add the Plugin to Unity

There are a few different Unity plugins. But most of them do not work with the Hackatime API. In light of this, Daniel-George created a fork of Vladfaust's plugin to work with Hackatime. Here are the instructions:

  1. Open Unity Hub and start a project
  2. Go to this GitHub page: Unity Hackatime Plugin
  3. Copy this text: https://github.com/daniel-geo/unity-hackatime.git#package
  4. Open your Unity project and click on Window > Package Management > Package Manager
  5. Click the plus sign on the top-left-corner of the screen
  6. Select "Install package from git URL..."
  7. Paste the text you copied earlier
  8. Click "Install"

After installing, you will need to grab your Hackatime API key and paste it into the Unity plugin:

  1. Open your Unity project
  2. Go to Window > Hackatime
  3. Insert your API key into the text field (grab it from the Config File on your settings page: https://hackatime.hackclub.com/my/settings)
  4. Click "Save Preferences"
  5. You are done!

Hackatime should start tracking these events:

  • DidReloadScripts
  • EditorApplication.playModeStateChanged
  • EditorApplication.contextualPropertyMenu
  • EditorApplication.hierarchyWindowChanged
  • EditorSceneManager.sceneSaved
  • EditorSceneManager.sceneOpened
  • EditorSceneManager.sceneClosing
  • EditorSceneManager.newSceneCreated

If Something Goes Wrong

Can't see your time? Go back to the setup page and try again.

Plugin not working? Close Unity and open it again. Or reinstall it using a different method listed on this page: Unity Hackatime Plugin

Package Manager not working? Make sure you're connected to the internet.

Still having trouble? Ask for help in Hack Club Slack - look for the #hackatime-v2 channel.

What Happens Next

Start making your game! Your time will show up on your Hackatime page in a few minutes.

Special thanks to Daniel-George for editing the original plugin for use with Hackatime.

Found an issue with this page? Edit it on GitHub - we'd love your help making the docs better!