> ## Documentation Index
> Fetch the complete documentation index at: https://rive-transitions-2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Inputs

export const subject_0 = "Inputs"

<Warning>
  **DEPRECATION NOTICE:** This entire page documents the legacy {subject_0} system.
  **For new projects:** Use [Data Binding](/game-runtimes/unity/data-binding) instead.
  **For existing projects:** Plan to migrate from {subject_0} to Data Binding as soon
  as possible. **This content is provided for legacy support only.**
</Warning>

## Accessing Inputs

There are three input types, each extends `SMIInput` (State Machine Input):

* `SMIBool` contains a `.Value` property, a boolean that can be set to true or false.
* `SMITrigger` is a boolean that is set to true for one frame by calling the `.Fire()` method.
* `SMINumber` contains a `.Value` property, a float that can be set to any value.

State machine inputs can be accessed in a number of different ways.

#### Access by name

Retrieve a state machine input by name and type.

**Trigger:**

```csharp theme={null}
SMITrigger someTrigger = m_stateMachine.GetTrigger("icon_02_press_trig");
if (someTrigger != null)
{
    someTrigger.Fire();
}
```

**Bool:**

```csharp theme={null}
SMIBool someBool = m_stateMachine.GetBool("centerHover");
if (someBool == null) return;
Debug.Log(someBool.Value);
someBool.Value = !someBool.Value;
Debug.Log(someBool.Value);
```

**Number:**

```csharp theme={null}
SMINumber someNumber = m_stateMachine.GetNumber("rating");
if (someNumber == null) return;
Debug.Log(someNumber.Value);
someNumber.Value = 4;
Debug.Log(someNumber.Value);
```

#### Access by index

Get the input count (length) and retrieve by index:

```csharp theme={null}
Debug.Log(m_stateMachine.InputCount());
SMIInput input = m_stateMachine.Input(1);
```

#### Access all inputs

Retrieve a list of all `SMIInputs`:

```csharp theme={null}
var inputs = m_riveStateMachine.Inputs();
foreach (var input in inputs)
{
    switch (input)
    {
        case SMITrigger smiTrigger:
        {
            // Do something
            break;
        }
        case SMIBool smiBool:
        {
            // Do something
            break;
        }
        case SMINumber smiNumber:
        {
            // Do something
            break;
        }
    }
}
```

## Accessing Nested Inputs

![Image](https://ucarecdn.com/2ef96393-bf13-4445-950b-1626235a25eb/)
set the **Volume** input from the above example:

```csharp theme={null}
m_file = Rive.File.Load(asset);
m_artboard = m_file.Artboard(0);
m_artboard.SetNumberInputStateAtPath("volume", 80.0f, "Volume Molecule/Volume Component");
```

**All options:**

* `void SetNumberInputStateAtPath(string inputName, float value, string path)`
* `float? GetNumberInputStateAtPath(string inputName, string path)`
* `void SetBooleanInputStateAtPath(string inputName, bool value, string path)`
* `bool? GetBooleanInputStateAtPath(string inputName, string path)`
* `void FireInputStateAtPath(string inputName, string path)`

### Additional Resources

For a complete example see the **getting-started** project in the [examples repository](https://github.com/rive-app/rive-unity-examples) and open the **StateMachineInputScene** scene. Enter **Play** mode and in the inspector on the **Main Camera** component, you can interact with all available state machine inputs for the provided animation.
