# AddStateMachineTransition

> Utility function to add an outgoing transition from the source state machine to the destination.

## Definition

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

## AddStateMachineTransition(AnimatorStateMachine)

Utility function to add an outgoing transition from the source state machine to the destination.

```csharp
public AnimatorTransition AddStateMachineTransition(AnimatorStateMachine sourceStateMachine)
```

### Parameters

**** (\[AnimatorStateMachine]\(/engine/6000.7/script-reference/unityeditor/animations/animatorstatemachine)): The source state machine.

### Returns

| Type                                                                                               | Description                                                                                                                         |
| -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [AnimatorTransition](/engine/6000.7/script-reference/unityeditor/animations/animatortransition.md) | The [AnimatorTransition](/engine/6000.7/script-reference/unityeditor/animations/animatortransition.md) transition that was created. |

### Remarks

The transition asset that is created is added as a sub asset of the state.

An example showing usage of this API can be found at the [AnimatorController](/engine/6000.7/script-reference/unityeditor/animations/animatorcontroller.md) page.

## AddStateMachineTransition(AnimatorStateMachine, AnimatorStateMachine)

Utility function to add an outgoing transition from the source state machine to the destination.

```csharp
public AnimatorTransition AddStateMachineTransition(AnimatorStateMachine sourceStateMachine, AnimatorStateMachine destinationStateMachine)
```

### Parameters

**** (\[AnimatorStateMachine]\(/engine/6000.7/script-reference/unityeditor/animations/animatorstatemachine)): The source state machine.**** (\[AnimatorStateMachine]\(/engine/6000.7/script-reference/unityeditor/animations/animatorstatemachine)): The destination state machine.

### Returns

| Type                                                                                               | Description                                                                                                                         |
| -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [AnimatorTransition](/engine/6000.7/script-reference/unityeditor/animations/animatortransition.md) | The [AnimatorTransition](/engine/6000.7/script-reference/unityeditor/animations/animatortransition.md) transition that was created. |

### Remarks

The transition asset that is created is added as a sub asset of the state.

An example showing usage of this API can be found at the [AnimatorController](/engine/6000.7/script-reference/unityeditor/animations/animatorcontroller.md) page.

## AddStateMachineTransition(AnimatorStateMachine, AnimatorState)

Utility function to add an outgoing transition from the source state machine to the destination.

```csharp
public AnimatorTransition AddStateMachineTransition(AnimatorStateMachine sourceStateMachine, AnimatorState destinationState)
```

### Parameters

**** (\[AnimatorStateMachine]\(/engine/6000.7/script-reference/unityeditor/animations/animatorstatemachine)): The source state machine.**** (\[AnimatorState]\(/engine/6000.7/script-reference/unityeditor/animations/animatorstate)): The destination state.

### Returns

| Type                                                                                               | Description                                                                                                                         |
| -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [AnimatorTransition](/engine/6000.7/script-reference/unityeditor/animations/animatortransition.md) | The [AnimatorTransition](/engine/6000.7/script-reference/unityeditor/animations/animatortransition.md) transition that was created. |

### Remarks

The transition asset that is created is added as a sub asset of the state.

An example showing usage of this API can be found at the [AnimatorController](/engine/6000.7/script-reference/unityeditor/animations/animatorcontroller.md) page.
