greendot Posted July 25, 2018 Share Posted July 25, 2018 I'm trying to destroy all the game objects of a scene but some of them still remain in the scene but they're not "active" any longer. By active I mean that they are still being shown and there are still movement applied to them, but they don't collide with other objects. They act like they are ghosts game objects. They way I'm clearing all the objects is like this: this.allGroups.forEach((group) => { group.children.entries.forEach((child) => { child.destroy(); }); group.clear(); }); allGroups is an array of GameObject groups of a scene. Am I doing anything wrong? Link to comment Share on other sites More sharing options...
greendot Posted July 25, 2018 Author Share Posted July 25, 2018 I changed group.children.entries.forEach to group.children.each and works fine now. Not sure why it didn't work with children.entries though. Link to comment Share on other sites More sharing options...
NoxBrutalis Posted July 25, 2018 Share Posted July 25, 2018 you could also do: yourGroup.remove(object, true true); the remove has too bool params one to remove from scene, one to destroy. Glad you got it working greendot 1 Link to comment Share on other sites More sharing options...
greendot Posted July 25, 2018 Author Share Posted July 25, 2018 Oh, I'm glad now that the remove function has the option to destroy. I remember seeing an earlier thread where this feature was looking to be incorporated. Thanks for the heads up Link to comment Share on other sites More sharing options...
Recommended Posts