nodelist.nodeAdded and nodelist.nodeRemoved signals lasts forever, if you do not call removeAll()

57 views
Skip to first unread message

Bulent OZTURK

unread,
Jun 26, 2013, 3:16:12 PM6/26/13
to ash-fr...@googlegroups.com
Hi everybody,

Today we had an interesting bug when trying to make a total reset for the game prototype we are working on then we find out that if we do not force removeAll() for the signals they remain there even after doing:

engine.removeAllEntities();
engine.removeAllSystems();

so we added;

nodeList.nodeAdded.removeAll();
nodeList.nodeRemoved.removeAll();

to the overridden removeFromEngine function in system.

Is this an expected behaviour and/or is there any other way to clean all signals for all nodes?

Thank you in advance
Bulent

Richard

unread,
Jun 27, 2013, 5:05:22 AM6/27/13
to ash-fr...@googlegroups.com
Hi

If you aded the nodelist listener, then it is your responsibility to remove it too. You are probably adding the listeners in the System.addToEngine() method. When a system is removed from the engine, its removeFromEngine method will be called, and you should remove your nodelist listeners there. I forgot to do this in my asteroids example, I'll add it shortly.

Richard

bulupe

unread,
Jun 27, 2013, 5:12:00 AM6/27/13
to ash-fr...@googlegroups.com
Thank you Richard, we already did what you suggest but we were wondering if there is a way to remove all signals from a single call. Thank you again for your fast response.
Reply all
Reply to author
Forward
0 new messages