Field attributes
Written above a field, they decide how the Inspector draws it: #[range(0.0..1.0)] makes a slider.
| Attribute | What it does |
|---|---|
| #[name("Label")] | What the inspector calls this field, instead of its own name. |
| #[tooltip("Text")] | The inspector's tooltip. Defaults to the field's /// comment. |
| #[group("Movement")] | The collapsing header this field sits under. A run of fields sharing one is drawn together. |
| #[subgroup("Jump")] | A second level inside #[group], which it requires. |
| #[range(0..500)] | Inclusive bounds on a numeric field. Draws a slider. |
| #[step(0.1)] | How far one drag notch moves a numeric field. |
| #[suffix("u/s")] | The unit the inspector prints after a numeric field. |
| #[readonly] | Draw this field, but do not let the inspector edit it. |
| #[color] | Draw a Vec4 as a colour swatch. |
| #[multiline] | Draw a String as a text area. |
| #[asset] | Draw a String as an asset slot the browser can drop into. |
| #[file("anim", "ron")] | Draw a String as a file picker, filtered to those extensions. |
| #[flags("Fire", "Ice")] | Draw an i32 as checkboxes, one label per bit from bit 0 up. |
| #[node_path("SpriteComponent")] | Draw an i32 as a node picker, for node to read. The argument filters it, and is optional. |
| #[allow(unused_field)] | Silence a lint on this field. |