Pause node issue

Pause node issue
0
#1

Hello,
I am trying to unschedule update function of one specific node to pause it, but i have a lot of problems with that. This is the approach that i am using:

var scheduler = cc.director.getScheduler();
scheduler.pauseTarget(this.node);

I also tried:

var scheduler = cc.director.getScheduler();
scheduler.unscheduleUpdate(this.node);

Do anyone have idea what i am doing wrong ?

Thanks in advance for your help :slight_smile:

#2

I’m also having problem when trying to pause a node tree recursively on Cocos Creator 1.9.3.
I use:
cc.director.getScheduler().pauseTarget(node)

but it still calls update method.

#3

Component class has it’s own update function. This function is called without scheduling in the scheduler. Maybe, this is your problem.
https://docs.cocos2d-x.org/creator/api/en/classes/Component.html#update
P.S. to turn off this update() use enable property.

1 Like
#4

@FocusCreative please don’t cross-post in multiple topics.

@Postelzhuk thank you for replying.

1 Like
#5

@Postelzhuk
Thanks. I’ve manually set update methods to empty function and restore on resume.

@slackmoehrle
I thought JS and Cocos Creator as seperate categories. Will be careful next time. Thanks.

#6

They are, but they don’t overlap as much as one might think. Creator API is different from the JS API mostly. Some concepts still apply though. Enjoy your day.