Hello everybody,
I’ve started using Cocos Creator recently and it’s been a great experience.
I’m using Cocos Creator 3.6.2 and I can’t figure out how to resume a specific node (or component) while the director is paused.
I have a pause menu that has an animation component. I use director.pause() in order to pause the game but now I don’t know how to play the animation of the pause menu.
I tried implementing my own pause system but I can’t figure out how to pause (not stop) particle systems and schedules.
@A_S Thank you for your solution. Just to be sure, is this how I’m supposed to do it?
let allPausableComps = find('PausableLayer').getComponentsInChildren(Component);
for (let i = 0; i < allPausableComps.length; i++) {
allPausableComps[i].enabled = false;
}
This pauses the game only when I have a single camera and it also pauses the game’s rendering entirely. So stuff like button states and animations stops working (because their associated camera is disabled.)
And when I use multiple cameras (e.g. one for the game and another for the menu), disabled components will completely disappear.
I think you need not pause all the components such as camera unless you have any tween to it. Instead you can get the specific components that have update method, tween, animations and schedulers.
But I am not sure what is the best way of doing this.