import { Node, Color4,Scene } from "@babylonjs/core";
// The path can change according to where your script is located
import { visibleInInspector } from "../decorators.ts";
export default class MyScript extends Node {
// Decorate the property using @visibleInInspector
@visibleInInspector("Color4", "Black Color", new Color4(0, 0, 0, 1))
public blackColor = new Color4(0, 0, 0, 1);
protected constructor() { }
public onInitialize(): void {
// ...
}
public onStart(): void {
// ...
}
public onUpdate(): void {
// ...
}
public onMessage(name: string, data: any, sender: any): void {
switch (name) {
case "myMessage":
// Do something...
break;
}
}
}
Once your script is saved, the Editor will update its interface in the “Inspector” panel to show you the new field that can be edited.