Page 1 of 1

Redundant call to onUpdateActionButtons

Posted: 19 September 2013, 16:48
by pikiou
Usually when entering a state, onUpdateActionButtons and onEnteringState are called once in that order.
But if it's a multiactiveplayer state, onUpdateActionButtons, onEnteringState then onUpdateActionButtons again are called.
Is there a reason for that second onUpdateActionButtons call ? I had to ignore it, just like any other call to it when a player becomes inactive or active in a multiactiveplayer state (that feature could be useful, though).

Re: Redundant call to onUpdateActionButtons

Posted: 19 September 2013, 21:19
by sourisdudesert
Hello,

Yes, onUpdateActionButtons can be called at any time to refresh the action button on the status bar, and this can happens multiple time during a state.

This is the reason why onUpdateActionButtons must only be used for "this.addActionButton" calls, and not for anything else. If you need to do something only once when entering in a gamestate, you can use onEnteringGameState instead.

Cheers,