Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all articles
Browse latest Browse all 2748

EventListenerCustom was not remove dproperly

$
0
0

@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

Read full topic


Viewing all articles
Browse latest Browse all 2748

Latest Images

Trending Articles



Latest Images