Cannot Add User Component in Phaser Editor 2D v4.11.2

Hi, I’m using Phaser Editor 2D v4.11.2, and I’m trying to add a User Component (script) to an object in the scene, but the option is not showing in the context menu (Right-click → Scripting → Add User Component), and there’s no + Add Component button in the properties panel either.

I created a .ts file inside the scripts/ folder and exported it as a class, but I can’t attach it to an object like a button or image in the scene.

Is this a limitation in v4.11.2? Or am I missing some setup step?

For User Components, you need to define the user component on a components file. Once you do this, the editor will generate the required .ts or .js file based on the component definition you have provided. Once you do this, the component should show up in the Add User Component modal that pops up. Defining the component in the .components file is what triggers the component to show up in that modal.

Usually, in the project templates there is a components folder with a file call Behaviors.components. You can define the component there, or create a new .components file in your project.