Jump to content

Child group update function does not get called


hellspawn_bg
 Share

Recommended Posts

I have a parent group that contains several child groups. Apparently only the update function of the parent group get's called. I would also like to call the update function of the childs. Is there a direct way to solve this, without iterating through the childs and manually calling update()?

 

Thanks :)

Link to comment
Share on other sites

Phaser definitely calls the child update functions:

https://github.com/photonstorm/phaser/blob/master/src/core/Group.js#L1175

This can happen if you subclass Phaser.Group but forget to call the parent function when you are overriding methods:
 

function MyGroup() {    Phaser.Group.apply(this, arguments);}MyGroup.prototype = Object.create(Phaser.Group.prototype);MyGroup.prototype.constructor = MyGroup;// if you override, make sure to call the parent function.MyGroup.prototype.update = function () {    Phaser.Group.prototype.update.apply(this, arguments);};
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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