How to Unpause Specific Nodes

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.

Thanks in advance.

Could anybody provide a sample for using this class?

I can’t figure out how to use it

Hello @adib, You can try using the Component.enabled property instead of director.pause().

1 Like

@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;
}

Does this make any performance issues?

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.

Am I doing something wrong here?

Is it possible to have multiple Directors for different layers of the game?

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.

1 Like

Thanks, your suggestions may help a lot in the future.
Unfortunately, I could not find a way to pause particle systems.

Yes the particle system will be paused but is not visible too.