> For the complete documentation index, see [llms.txt](https://postica.gitbook.io/binding-system-3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://postica.gitbook.io/binding-system-3/reference/attributes.md).

# Attributes

Every attribute that affects a bind field, a modifier or the menus.

All in the `Postica.BindingSystem` namespace, except `[TypeDescription]` which lives in `Postica.Common`.

## On bind fields

<table><thead><tr><th width="270">Attribute</th><th>What it does</th></tr></thead><tbody><tr><td><code>[Bind]</code></td><td>Marks the field as a bind type. Use it when several drawing attributes are combined and they need to be ordered into one draw pipeline.</td></tr><tr><td><code>[Bind(BindMode)]</code></td><td>Forces the field into a mode.</td></tr><tr><td><code>[ReadOnlyBind]</code></td><td>Read only. The bind path menu offers only readable members.</td></tr><tr><td><code>[WriteOnlyBind]</code></td><td>Write only. The menu offers only writable members.</td></tr><tr><td><code>[BindType(Type)]</code></td><td>Restricts the field to values of that type. Needed for generic containers where the type cannot be inferred.</td></tr><tr><td><code>[BindMode(BindMode)]</code></td><td>A mode on a field, property, class or struct.</td></tr><tr><td><code>[AllowDefaultValues]</code></td><td>Lets the field offer the default value of its type as an explicit choice.</td></tr><tr><td><code>[MultiUpdate]</code></td><td>Declares that the field can update several times per frame.</td></tr><tr><td><code>[DynamicBindType]</code></td><td>The bind type is decided at runtime rather than declared.</td></tr><tr><td><code>[BindTypeSource(fieldPath)]</code></td><td>Takes the bind type from another field. For expert use.</td></tr><tr><td><code>[InlineToggle(field, onText, offText)]</code></td><td>Draws a sibling <code>bool</code> field as a pill on this bind field's row, showing one word for each state. For an option that is one word about the field beside it. Mark the <code>bool</code> <code>[HideInInspector]</code> too, or it keeps its own row. Honoured on bind fields only.</td></tr></tbody></table>

```csharp
public class Turret : MonoBehaviour
{
    [ReadOnlyBind]  public Bind<float> targetAngle;
    [WriteOnlyBind] public Bind<bool>  isFiring;
    [Bind(BindMode.Read)] public Bind<int> ammo;

    [AllowDefaultValues]
    public Bind<Transform> optionalTarget;
}
```

`[InlineToggle]` is how a converter or modifier puts a small switch where it reads best, beside the value it qualifies:

```csharp
[Serializable]
public class StringToPrice : IConverter<string, decimal>
{
    [InlineToggle(nameof(fallbackOnEmpty), "Invalid or empty", "Invalid only")]
    public Bind<decimal> fallback;

    [HideInInspector]
    [Tooltip("Whether an empty string also takes the fallback value.")]
    public bool fallbackOnEmpty;

    // ...
}
```

## Controlling the bind path menu

<table><thead><tr><th width="270">Attribute</th><th>What it does</th></tr></thead><tbody><tr><td><code>[HideMember]</code></td><td>Hides the member from the bind path menu entirely.</td></tr><tr><td><code>[HideMember(Hide.InternalsOnly)]</code></td><td>Keeps the member visible but stops navigation into its own members.</td></tr></tbody></table>

```csharp
[HideMember]
public float internalCounter;                       // not offered at all

[HideMember(HideMemberAttribute.Hide.InternalsOnly)]
public ComplexThing thing;                          // bindable, but not walked into
```

For hiding members of types you do not own, the editor applies global filters through `ReflectionFactory`. That is how `GameObject.transform` is hidden while `Transform` stays fully bindable. Those filters are applied at editor load and are not hot-reloadable: changing one needs a domain reload.

## On modifiers

<table><thead><tr><th width="270">Attribute</th><th>What it does</th></tr></thead><tbody><tr><td><code>[TypeDescription(string)]</code></td><td>The description shown in the Add Modifier menu and as the tooltip.</td></tr><tr><td><code>[OneLineModifier]</code></td><td>Draw the modifier on one line rather than as a foldout. Right for a single-field modifier.</td></tr><tr><td><code>[ModifierOptions]</code></td><td>How the modifier is offered: <code>ModifierMode</code> to force a mode, <code>AllowSimilarTypes</code> to also allow similar modifiers for base types, and a switch for applying to derived types.</td></tr></tbody></table>

See [Custom Modifiers](/binding-system-3/reference/extending/modifiers.md).

## Code generation

<table><thead><tr><th width="270">Attribute</th><th>What it does</th></tr></thead><tbody><tr><td><code>[EnableStandardModifiers]</code></td><td>Generates the generic standard modifiers for your type. See <a href="/binding-system-3/pipeline/standard-modifiers.md">Standard Modifiers for Your Types</a>.</td></tr><tr><td><code>[EnableStandardModifiers(StandardModifierKinds)]</code></td><td>Only the kinds you name. Reference types always get every applicable kind.</td></tr><tr><td><code>[RegistersGeneratedModifiers]</code></td><td>Marks a static parameterless method as the registration entry point for generated modifiers. Called at editor startup.</td></tr><tr><td><code>[RegistersCustomAccessors]</code></td><td>Marks a type as registering custom accessors.</td></tr><tr><td><code>[AutoGenerated(Type generator)]</code></td><td>Marks a type as auto generated, and by what.</td></tr><tr><td><code>[GeneratedBind]</code></td><td>Marks a bind field as generated by the system.</td></tr></tbody></table>

`StandardModifierKinds` values: `SetValue`, `LinksTo`, `NullCheck`, `Delay`, `Log`, `Events`, `Conditions`, plus `None` and `All`.

## Editor lifecycle

<table><thead><tr><th width="270">Attribute</th><th>What it does</th></tr></thead><tbody><tr><td><code>[OnBindSystemUpgrade]</code></td><td>Marks a static method called once when the package is upgraded, with the version you came from as its argument. Use it to migrate your own binding-related data.</td></tr></tbody></table>

```csharp
[OnBindSystemUpgrade]
private static void Upgrade(string fromVersion)
{
    if (string.Compare(fromVersion, "3.0.0", StringComparison.Ordinal) < 0)
    {
        // migrate
    }
}
```

## Attributes from other packages that are respected

<table><thead><tr><th width="270">Attribute</th><th>What it does</th></tr></thead><tbody><tr><td><code>[Tooltip]</code></td><td>Used as the tooltip on bind fields and on modifier and converter fields.</td></tr><tr><td><code>[SerializeField]</code>, <code>[SerializeReference]</code></td><td>Normal Unity serialization. Converters and modifiers are stored through <code>[SerializeReference]</code>, which is what makes them polymorphic.</td></tr><tr><td><code>[FormerlySerializedAs]</code></td><td>Respected. It keeps the <em>value</em> across a rename; <a href="/binding-system-3/project-tools/diagnostics/refactoring.md">refactoring</a> keeps the <em>bindings</em>. Use both.</td></tr><tr><td>Odin's <code>[AssetsOnly]</code>, <code>[SceneObjectsOnly]</code></td><td>Propagated to the source field, and reported as <em>Assets NOT Allowed</em> or <em>Scene Objects NOT Allowed</em>. See <a href="/binding-system-3/reference/integrations/odin-inspector.md">Odin Inspector</a>.</td></tr></tbody></table>

## Interfaces worth knowing beside the attributes

<table><thead><tr><th width="270">Interface</th><th>What it is for</th></tr></thead><tbody><tr><td><code>IBindController</code></td><td>An empty marker. An object implementing it can pause, resume and refresh its own bindings. See <a href="/binding-system-3/overview/runtime-control.md">Controlling Bindings at Runtime</a>.</td></tr><tr><td><code>IDynamicComponent</code></td><td>Declares that a converter's or modifier's output can change without its input changing. See <a href="/binding-system-3/project-tools/performance/phased-bindings.md">Phased Bindings</a>.</td></tr><tr><td><code>IRequiresAutoUpdate</code></td><td>A modifier that needs the binding to update automatically.</td></tr><tr><td><code>IBindVariableContainer</code></td><td>Supplies <a href="/binding-system-3/overview/bind-variables.md">bind variables</a>.</td></tr><tr><td><code>IAccessorProvider</code></td><td>Supplies <a href="/binding-system-3/reference/extending/accessor-providers.md">bindable paths</a> that are not members.</td></tr><tr><td><code>IValueProvider&#x3C;T></code></td><td>Supplies a <a href="/binding-system-3/reference/extending/value-providers.md">value</a> to a parameter or a modifier field.</td></tr></tbody></table>
