We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause.
What is the recommended practice?
We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause.
What is the recommended practice?
So as it turns out you should put as little on the Cocos thread as you can. Things you schedule here get run for every frane! It's sometimes an easy way to get things synced between GUI and background logic, but it will make your game slow.
Thread are something that you have to avoid as long as possible. sure they make all the thing easier in some conditions but they may also create some enexpeted behavior that are really hard to trace. so for your example i prefer some flag to stop update functions to do their animate jobs since you can easily implement it that way.
in general specially for iphone/android that using threads doesn't give any boost in performance (and sometimes might even reduce fps) I prefer to do all the jobs by hand. except some very rare cases such as loading game content while playing animations there is no need to use threads at all, so you have to avoid using them.