- Home /
Update Preference Item when Preference menu is closed
Hi!
I am making a preference item that counts total time spent on my project. Currently I have it working 95%.
The only problem is that, when I don't have the window open, it doesn't update. As soon as I open the preference menu, it updates.
So if I close my project without the preference window open, it doesn't count the last amount of time spent on the project...
Any suggestions?
Answer by kork · Feb 10, 2016 at 07:56 PM
You could subscribe to EditorApplication.update
to have a function of your code called on every update of the editor application. That way you won't need an open window.
EditorApplication.update += CountTime;
void CountTime() {
// do something useful here.
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Unity Package Manager UI Error Socket IO Unity after updating from 2017.3 to 2018.1.0f2 Nodejs 1 Answer
Unity Restores default Preferences every launch; Fix? 0 Answers
Too many errors in the IDE (even for a fresh project), but editor doesn't throw any errors! 1 Answer
Coroutine in Editor? 7 Answers