@sonlehong wrote:
Hi guys,
I add a new custom event listener by using the statement code below:EventListenerCustom* eventCus = Director::getInstance()->getEventDispatcher()->addCustomEventListener(Director::EVENT_AFTER_SET_NEXT_SCENE, [&](EventCustom *event) { Director::getInstance()->getEventDispatcher()->removeEventListener(eventCus); doSomething(); });
But it seems eventCus was not removed when using “removeEventListener” function. The callback keep being called after I switch to another scene.
Does anyone meet this issue before? Please give me some advice.
Thank you!
Posts: 1
Participants: 1