Existing solutions didn't work for me (https://github.com/josec89/wakatime-unity is obsolete and https://github.com/bengsfort/WakaTime-Unity requires Python), so I decided to implement my own variant.
The code has been successfuly tested with following Unity versions:
- 2017.4.0f1
- 2018.1.0b13
- 2018.1.2f1
- Getting
'UnityEditor.EditorApplication.hierarchyWindowChanged' is obsolete: Use 'EditorApplication.hierarchyChanged'
warning on Unity 2018.x
The Unity Package Manager (UPM) is a new method to manage external packages. It keeps package contents separate from your main project files.
- Copy the folder
com.vladfaust.unitywakatime
into your project'sPackages
folder (not visible in the "Projects" tab) - Modify your project's
Packages/manifest.json
file to add the line:Make sure it's still a valid JSON file. For example:"com.vladfaust.unitywakatime": "file:com.vladfaust.unitywakatime"
{ "dependencies": { "com.unity.ads": "2.0.8", "com.vladfaust.unitywakatime": "file:com.vladfaust.unitywakatime" } }
If not using the Unity Package Manager, copying the files locally also work.
- Copy the
Editor
folder from insidecom.vladfaust.unitywakatime
into your project Assets
- Run the Unity editor, go to
Window/WakaTime
, and insert your API key (grab one from https://wakatime.com/settings/account) - Press
Save Preferences
- Check if
"Unity"
editor appears at https://wakatime.com/api/v1/users/current/user_agents (may be a bit delayed) - Enjoy!
The plugin will automatically send heartbeats to WakaTime after following events:
- DidReloadScripts
- EditorApplication.playModeStateChanged
- EditorApplication.contextualPropertyMenu
- EditorApplication.hierarchyWindowChanged
- EditorSceneManager.sceneSaved
- EditorSceneManager.sceneOpened
- EditorSceneManager.sceneClosing
- EditorSceneManager.newSceneCreated