When call this.destroy() in GameObject which is added in some group, this object is still in the group and require call groupName.remove(gameObject, true /* removeFromScene */);
I think this should be called automaticly when is GameObject.destoy() called ? Or it should be strict like this ?
This cause some diffucilty debug issues, like each function up on this group. When this removed GameObject try access to this.scene property, it will crashed asn undefined property
This is very nicely solved in Phaser CE in destroy compnent when child call this.parent.remove(this)
https://github.com/photonstorm/phaser-ce/blob/29bc2b2d76f432a34fdb36ecc8ee634e0d8fdaf0/src/gameobjects/components/Destroy.js#L37-L56
So it should be somethink like this, here: https://github.com/photonstorm/phaser/blob/d1d8d4c4a2bbcbfbedd3151ce9f3055810de2b83/src/gameobjects/GameObject.js#L305-L369
But problem is, GameObject not have proprty like parrent.
Groups are no longer exclusive, a single GameObject can exist in many Groups, so it can't be automatically removed as part of the destroy process. A Group could listen for the destroy event from a child though, and remove if it receives that.
This feature is now implemented in the master branch.
Most helpful comment
Groups are no longer exclusive, a single GameObject can exist in many Groups, so it can't be automatically removed as part of the destroy process. A Group could listen for the
destroyevent from a child though, and remove if it receives that.