phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Usage description of CHANGE_DATA_KEY event in the docs is wrong.

Open christian-post opened this issue 2 years ago • 0 comments

Version

  • Phaser Version: latest

Description

https://newdocs.phaser.io/docs/3.55.2/Phaser.Data.Events.CHANGE_DATA_KEY

The docs for the CHANGE_DATA_KEY event are describing the usage as:

So, to listen for the change of a specific data item from a Game Object you would use: sprite.data.on('changedata-key', listener), where key is the unique string key of the data item. For example, if you have a data item stored called gold then you can listen for sprite.data.on('changedata-gold').

However, this doesn't work. You either have to use sprite.data.events.on or simply sprite.on to listen to this event.

christian-post avatar May 12 '22 17:05 christian-post