I've run into a similiar issue in Cocos2dx-3.8, trying to schedule a selector in one Scene I was developing.
My malfunctioning code was:
void GameScene::onEnter() {
this->scheduleOnce(CC_SCHEDULE_SELECTOR(GameScene::scheduledSelector), 3.0);
this->scheduleUpdate();
}
void GameScene::scheduledSelector(float dt) {
log("Scheduled selector called...");
}
void GameScene::update(float delta) {
log("update called...");
}
Neither scheduledSelector nor update got called in this situation.
I found the solution to my problem in the Cocos2dx Node documentation: A Node's scheduler will not start scheduling updates until the Node calls its resume method:
/**
* Resumes all scheduled selectors, actions and event listeners.
* This method is called internally by onEnter.
*/
virtual void resume(void);
My bad was that I overrided Node's onEnter method without calling through the superclass implementation, so the scheduler never got a signal to start the updates. Fixing my onEnter method with:
void GameScene::onEnter() {
Node::onEnter();
this->scheduleOnce(CC_SCHEDULE_SELECTOR(GameScene::scheduledSelector), 3.0);
this->scheduleUpdate();
}
did the job and both selectors began to be called at the right time.