Accessing sprite data?

Hi Everyone, I’m trying to access the data of a Sprite, but it’s coming up null in these situations:

export default class Player extends Phaser.Physics.Arcade.Sprite {
  constructor(scene, x, y) {
   console.log(this.data) //null

and

this.player = new Player(this, spawnPoint.x, spawnPoint.y);
console.log(this.player.data); //null

Would anyone be able to tell me how or when to access it? I’d love to be able to set data properties on sprite creation in the class constructor.

data :Phaser.Data.DataManager

A Data Manager. It allows you to store, query and get key/value paired information specific to this Game Object. null by default. Automatically created if you use getData or setData or setDataEnabled .

So null seems correct.
If you want the class members, try logging without .data.

This, specifically, is the part of the documentation that’s significant here. If you want to use Phaser’s built-in data manager, use getData and setData on the sprite instead of accessing data directly.