scene-declare-prefab-property
Add a new user property to a prefab scene, defining its name, type, options, and default values for game object customization.
Instructions
Create a new user property for the given prefab.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the user property. The editor compiles a prefab user property as a field of the prefab class. This name is used as variable name for that field. | |
| type | Yes | ||
| label | Yes | The display name of the property. It is used in the editor to show the property name in the user interface. | |
| sceneId | Yes | The `id` of the prefab scene. The `id` is not the name of the scene, else a unique identifier is set in the scene data. You need to read the scene data to get the `id`. This id refers only to the scenes that are prefabs. | |
| tooltip | Yes | A very short description. | |
| defValue | No | A user property is always initialized with a default value. It could never be null or undefined. Its raw type is string, number, or boolean, but the format/syntax of the value depends on the type of the property. If the property is an array, then this property refers to the default element of the array when the user adds a new element. To set the default array, use the `defArrayValue` property. If the type is `option`, then the default value should be one of the provided options. Look the `type` property for more details. | |
| defArrayValue | No | If the property is an array, this is the default array. If the property is not an array, this value is ignored. The type of each element of the array must follow the same rules as the `defValue` property. Look the `defValue` property for more details. | |
| customDefinition | No | By default, a user property is generated in code as a field. If you set this property to true, then the editor skips the generation of the field definition in code, so the user can write a custom property declaration. Most of the time the user doesn't need to do this. |