User Components Editor
Components (or similar patterns) are widely used in popular game engines or editors. Many of these tools use custom scripting languages or certain elements of a language (like metadata or attributes) to provide the components information, like properties description, default values, UI rendering, etc… The code of the component has the metadata of the component as part of its implementation.
In Phaser Editor 2D, for now, it is different. We use configurations (JSON) files and a User Components compiler that parses these files and generates the JavaScript (or TypeScript) code of the components. Or better say, a part of the component’s code, because, just like the Scene Editor does with the scene files, you can insert your code inside the output of the User Components compiler.
The information available in the configuration (*.components
) files are used by the Scene Editor for building the UI elements needed to add and edit the components of a game object. It is not required by the game at run-time. We strongly recommend to exclude it from the distribution build of your game.