iphone - Performance decreases after a while especially when device is resting -


i have iphone game using unity game engine , self written library access apple's core motion framework. performance excellent on iphone 5 , used pretty on iphone 4 in past.

running app today on iphone 4 (ios 6.1.3) continuous drop in frame rate occurs after while (noticeable after 5-10 minutes). after 20-30 minutes game unplayable , appears run in slow motion.

the strange thing is: effect occurs when device lying still on table. when move device, frame rate rises noticeably decreases again when there no movement. found out game code written in c# (unity game engine) not blame obj-c part handling motion control core motion.

i think problem began time when updated ios 5.1.x ios 6.1.3 not sure. it's hard exact time in revision history when problem has started, because did longer tests on fancy iphone 5 , quick tests on iphone 4 (ok, lesson learned ;-).

i use 'old style' pull approach fetch cmdevicemotion instances i.e. startdevicemotionupdates without block handler. pulling code runs in separate thread, turned out perfomant way - well, in past.

unity's built-in ios profiler (console) doesn't show significant memory consumption, think native code plugin not considered in statistics. xcode profiler didn't show leaks far can see it. bulk of memory allocations , deallocs, bit surprising me (i think recycling cmdevicemotion instances internally might faster when polling, cares).


question: there known issues constellation on ios 6? mean, pulling, running in separate thread, 60 hz, combined unity game engine + open gl es 2, ...

finally found culprit: devicemotionupdateinterval
more precise changing interval pretty often.

according section choosing motion event update interval in event handling guide ios larger interval improves battery life. implemented logic slow down frequency 2hz when game not active i.e. game over, pausing, main menu, ... when resuming game play frequency set 60 hz again.

after commenting out code changing frequency, problem disappeared. decided not longer try save battery consumption way.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -