Hi,
we develop a board game which only use UI components. Most of the time nothings happens on the screen – until the user interacts.
To reduce battery usage, we created an idle mode with a reduced targetFrameRate of 5. After the user interacts, the targetFrameRate jumps back to 60fps to get smooth animations. Works good so far. But there is a problem with fast interactions, like dragging things. Cause of the 5 frames per second all interactions are analysed only 5 times in the second (in Update()). Considerably too long for drag actions.
So we moved the “interaction-check-routine” in the FixedUpdate() function and get now a nearly instant feedback. The problem is that if we set targetFrameRate in FixedUpdate() the setting is ignored until the next Update() cycle. To visualize this problem:
Current situation (simplified)
1.00 FixedUpdate()
1.00 Update()
1.02 FixedUpdate()
1.04 FixedUpdate() > user interaction: setting targetFrameRate = 60
1.06 FixedUpdate()
1.08 FixedUpdate()
1.10 FixedUpdate()
1.12 FixedUpdate()
1.14 FixedUpdate()
1.16 FixedUpdate()
1.18 FixedUpdate()
1.20 FixedUpdate()
1.20 Update() > from now on is targetFrameRate=60 in use
1.22 FixedUpdate()
1.22 Update()
1.24 FixedUpdate()
1.24 Update()
1.26 FixedUpdate()
1.26 Update()
Goal (simplified)
1.00 FixedUpdate()
1.00 Update()
1.02 FixedUpdate()
1.04 FixedUpdate() > user interaction: setting targetFrameRate = 60
1.04 Update() > from now on is targetFrameRate=60 in use
1.06 FixedUpdate()
1.06 Update()
1.08 FixedUpdate()
1.08 Update()
1.10 FixedUpdate()
1.10 Update()
I tried a lot, but I did not get it working.
Now I hope you can help me to find a solution in something like this:
1. Forcing an instant update cycle of the screen?
Using BroadcastMessage() seems to start the Update() functions, but did not reset the Update cycle.
Is it possible to manually call an “real” update cycle, like Actionscript was with updateDisplayList()?
2. Setting something like “lastUpdateTime”?
Is there an timer that I can set to a older time to force an earlier Update cycle?
I would appreciate any ideas!
Thanks
Jan