# AddAnyStateTransition

> Utility function to add an AnyState transition to the specified state or statemachine.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Animations](/engine/6000.3/script-reference/unityeditor/animations.md)
* **Assembly:** UnityEditor

## AddAnyStateTransition(AnimatorState)

Utility function to add an AnyState transition to the specified state or statemachine.

```csharp
public AnimatorStateTransition AddAnyStateTransition(AnimatorState destinationState)
```

### Parameters

**** (\[AnimatorState]\(/engine/6000.3/script-reference/unityeditor/animations/animatorstate)): The destination state.

### Returns

| Type                                                                                                         | Description |
| ------------------------------------------------------------------------------------------------------------ | ----------- |
| [AnimatorStateTransition](/engine/6000.3/script-reference/unityeditor/animations/animatorstatetransition.md) |             |

### Remarks

The transition asset that is created is added as a sub asset of the state machine. Its important that AnyStateTransitions are added to the root state machine. AnyStateTranistions added to a sub state machine will be discarded at runtime. This function pushes an Undo operation.

## AddAnyStateTransition(AnimatorStateMachine)

Utility function to add an AnyState transition to the specified state or statemachine.

```csharp
public AnimatorStateTransition AddAnyStateTransition(AnimatorStateMachine destinationStateMachine)
```

### Parameters

**** (\[AnimatorStateMachine]\(/engine/6000.3/script-reference/unityeditor/animations/animatorstatemachine)): The destination statemachine.

### Returns

| Type                                                                                                         | Description |
| ------------------------------------------------------------------------------------------------------------ | ----------- |
| [AnimatorStateTransition](/engine/6000.3/script-reference/unityeditor/animations/animatorstatetransition.md) |             |

### Remarks

The transition asset that is created is added as a sub asset of the state machine. Its important that AnyStateTransitions are added to the root state machine. AnyStateTranistions added to a sub state machine will be discarded at runtime. This function pushes an Undo operation.
