Pause() and resume() causing errors

Pause() and resume() causing errors
0

I have a pause function in my game implemented by iterating through all the main layer’s children and calling pause() and resume() on them as appropriate. It’s working fine but I’d also like to pause the functions I have scheduled on the main layer using these two functions:

Director::getInstance()->getScheduler()->pauseTarget(this);
Director::getInstance()->getScheduler()->resumeTarget(this);

However, the next time a function is scheduled on the main layer after a pause/resume using these, I get the following assert failed:

Assert failed: element's paused should be paused.
Expression: element->paused == paused

I get the same results using the standard ->pause() and ->resume() called on the main layer.

Any help working out what this means would be great :slight_smile: