Phaser API Documentation

  Version: 
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Event: SET_DATA
Phaser.Data.Events.SET_DATA
SET_DATA

Description:

The Set Data Event.

This event is dispatched by a Data Manager when a new item is added to the data store.

Game Objects with data enabled have an instance of a Data Manager under the data property. So, to listen for the addition of a new data item on a Game Object you would use: sprite.data.on('setdata', listener).

Parameters:

name type description
parent any

A reference to the object that owns the instance of the Data Manager responsible for this event.

key string

The unique key of the data item within the Data Manager.

data any

The item that was added to the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance.

Since: 3.0.0