codeserk/wakatime-unity

Unity plugin is malfunctioning

Opened this issue · 2 comments

Hi!

The Wakatime sens notification:
"We noticed some unusual coding activity from your Unity WakaTime plugin Yesterday:
You have many duplicate heartbeat events.

This is usually caused by another Unity extension tricking WakaTime into thinking you’re moving the cursor or editing files.
If you would like to help fix this, please add the list of Unity extensions you have installed to an existing GitHub issue or just reply to this email."

Actually, what happens is we are testing the multiplayer solution on one PC and two instances of the app running with a local server. With mouse right-click you can change a mode of interaction with the application:

  1. Interact with the on-screen UI.
  2. Interact with the objects and FP-controller (turn camera) within the app.

Basically, this causes the malfunction and dramatically reduces the time recorded by WT.

That You have many duplicate heartbeat events. message is sent when you have over 30k heartbeats per day, because wakatime plugins are limited to only sending 1 heartbeat every 2 minutes when editing the same file. The 30k is just a rough guess because that many heartbeats per day is usually never possible with normal activity.

The unity-wakatime plugin also limits to sending a heartbeat once every 2 minutes (120 seconds) while editing the same file:

internal const int TIME_TO_HEARTBEAT = 120;

if (diffInSeconds < WakaTimeConstants.TIME_TO_HEARTBEAT)

So sending too many heartbeats shouldn't be possible with unity-wakatime, unless:

  1. a bug in unity-wakatime allows sending heartbeats faster than one per 2 minutes
  2. you're editing many different files inside Unity in a short amount of time (think auto-save all open files, even ones without changes)
  3. you're using the same api key for multiple people

When you're testing your multiplayer solution, does it cause Unity to change the currently focused layer? That could trigger number 2 which would generate abnormally large amount of coding activity.