- Home /
Changing windows timer Resolution in unity3d windows builds...
I am trying to change the windows timer resolution for our game on windows. By timer resolution, I mean the resolution such as modified by calls to timeBeginPeriod/timeEndPeriod in windows.
After struggling to do this, I managed to guess that at some point unity does a timeBeginPeriod(1) call, asking the system for a 1ms timer resolution. I tried to revert it by calling a timeEndPeriod but this seems to me a really hacky solution since another timeEndPeriod will surely be done by unity at some later point.
I want to this to have a power efficient application which does not have a resolution smaller than 10ms and restores the system's default resolution (15.6ms) while being inactive. So far, I could set the 10ms resolution by calling a timeBeginPeriod(10) (which surprisingly works even without calling the timeEndPeriod(1) since windows is supposed to take the smaller resolution request in priority). I was not able to revert to the system's 15.6 ms resolution tough.
I know this question is a bit specific, but I believe it could be of interest to developers targeting the windows platform, especially if the partner with Intel's AppUp program which strongly recommend those power saving behaviors.
Thank you very much for your help!
-- David St-Hilaire