Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Does calling removeAll(true) on a Group guarantee that all elements inside it will be destroyed properly?


threedollarbill
 Share

Recommended Posts

Does calling "removeAll(true)" on a group really result in a complete nuke?

I have a Group that has plenty going on inside it. It contains plenty of sub groups, which themselves also have more sub groups.

They have tweens going on, and some of them are listening to events such as "game.load.onFileComplete", etc etc..

I guess to keep it short, what I'm trying to say is, does calling "removeAll(true)" guarantee me that all elements created within that group will be marked for garbage collection? Provided that nothing outside the group is referencing them in any variable..?

 

 

Link to comment
Share on other sites

Use the source, Luke! https://github.com/photonstorm/phaser/blob/32326ae2434fb47d24def0b21ed8b818fbc72f55/src/core/Group.js#L2417

Since tweens and timers aren't added to groups you'll have to cancel those yourself. Same with signals. You can always subscribe to the "events.onRemovedFromGroup" signal to help you clean this stuff up, if you want.

As far as the GC -- yes, if there are no more references to a JS object the GC will eventually clean it up.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...