Existing solutions didn't work for me (https://github.com/vladfaust/unity-wakatime, and other solutions lack an option for sending heartbeats to different API URLs, such as to Hackatime), so I decided to fork vladfaust's solution to support Hackatime, Wakatime and others using the API URL.
The Unity Package Manager (UPM) keeps package contents separate from your main project files.
- In the Unity Package Manager, click on the plus sign in the top left corner
- Select "Install package from git URL..."
- Enter the following line:
https://github.com/daniel-geo/unity-hackatime.git#package
- Click on the install button
-
Modify your project's
Packages/manifest.json
file by adding this line:"com.daniel-geo.unityhackatime": "https://github.com/daniel-geo/unity-hackatime.git#package"
Make sure it's a valid JSON file. For example:
{ "dependencies": { "com.unity.ads": "2.0.8", "com.daniel-geo.unityhackatime": "https://github.com/daniel-geo/unity-hackatime.git#package" } }
If you don't use the Unity Package Manager, you may copy the Editor
folder from inside Assets/com.daniel-geo.unityhackatime
into your project's Assets
folder.
- Run the Unity editor, go to
Window/HackaTime
, and insert your API key (grab one from https://hackatime.hackclub.com/my/wakatime_setup) - Press
Save Preferences
- Enjoy!
The plugin will automatically send heartbeats to HackaTime after the following events:
- DidReloadScripts
- EditorApplication.playModeStateChanged
- EditorApplication.contextualPropertyMenu
- EditorApplication.hierarchyWindowChanged
- EditorSceneManager.sceneSaved
- EditorSceneManager.sceneOpened
- EditorSceneManager.sceneClosing
- EditorSceneManager.newSceneCreated
This plugin wouldn’t exist without @taciturnaxolotl
A huge thanks to @unsaltedkale for her valuable help in testing the project