Custom properties in the inspector

Hi guys

What is the simplest way of having custom properties in the inspector?

We would like to let game designer tune parameters on some object. For example, delay after roulette has finished a spin and some other timings on objects.

Our expectation is that the designer selects a wheel and have an additional set of properties in inspector which are WheelMesh properties.

What is the simplest way to approach this? Anything ready to use?

Our idea is to have TS decorator @inspectable on class properties and then add a custom property grid to the inspector bringing the experience quite close to the Unity3D inspector. Is this something BJS would like to have a PR on? Or we are going to make exceeding job and this could be achieved in an easier way?

Well there are customisation support on the scene explorer but not yet on the inspector side.
But I’m interested to add that for you :slight_smile:

Here is a first idea:

  • You can provide a string that will be used to detect the entity.getClassName()
  • When an item is selected if its getClassName resolve to the string you provide, I can call a specific property list for it
  • The property list can be describe with something like:
        label: "myProperty",
        type: "checkbox", // or slider or vector3 or color3
        min: 10, // for slider
       max: 100 // for slider
    }, ...
1 Like

Sounds great! And I assume on our side properties list might be generated with decorators as planned.

Not sure classname is the best approach here. May be just presence of this array on instance? For example if (gameObject.inspectables && gameObject.inspectables.length > 0) return . So to respect initial class props and custom instance props.

the way you want :slight_smile:
please open a feature request on the repo so I can track it (will probably work on it next week)

Yay, thrilled to have this. Would be a huge boost for our games development flow! Now we are forced to recompile every time parameter changed or use console which is not suitable for 3d or game designer or product owner…

Feature request is here Custom inspectable fields for inspector · Issue #5957 · BabylonJS/Babylon.js · GitHub

I like it! And because you guys need it I will do it today