User properties in a prefab instance

This is how the properties you defined in a prefab are presented in the Prefab Instance section of a prefab instance:

User properties in a prefab instance.

The user properties are shown just like any other property of a prefab instance.

The code, generated by the scene compiler, that creates the prefab instance and initialize the properties will look like following. Note the dragon instance is created first, and the user properties are initialized later, at the end of the method. By setting the user properties at the end, it allows you to set references to another objects created in the scene:

class Level extends Phaser.Scene {
...
    create() {
        ...

        // dragon
        const dragon = new Dragon(this, 370, 218);
        this.add.existing(dragon);

        ...

        // dragon (prefab fields)
        dragon.maxSpeed = 300;
        dragon.flameType = "smoke";
        dragon.onClickHandler = obj => this.selectDragon(obj);
        dragon.emit("prefab-awake");
        ...
    }
...
}

In the next sections are covered the topics to create prefab instances and to change the properties.