- Home /
Recognise Editor afk
I want to recognize global afk when not developing with Unity but the Editor-Application is running, so an editor script needs to run in the background thats NOT attached to a scene.
Since Input class is only for runtime I cannot use this with Input.anykey and Input.mousePosition.
Is there any Editor function that recognizes the mouse has moved or key pressed? This is what I've got so far:
[InitializeOnLoad]
public class EditorUtils {
static EditorUtils(){
EditorApplication.update += HandleUpdate();
}
static void HandleUpdate(){
bool afk = isAFK();
//do further assignments / use with afk bool
}
static bool isAFK(){
Event e = Event.current //its null.
throw new System.NotImplementedException();
}
}
One thing I can suggest is to create a new script on the player and have for example a 5 $$anonymous$$ute timer, if any key is pressed or the mouse is moved/clicked then reset the timer back to 5 $$anonymous$$utes, if the timer is on 0 then set afk to true, thats all I can provide as Im not sure how to get mouse movement as a function.
Hi, I mean the afk tracking of the unity Editor itself when developing, not when actual playing ;)
Oh sorry I had misread, sorry I am unsure about that, sorry I couldnt help.