# SetStateEffectiveMotion

> Sets the effective Motion for the AnimatorState. The Motion is either stored in the AnimatorStateMachine or in the AnimatorLayer's ovverrides. Use this function to set the Motion that is effectively used.

## Definition

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

## SetStateEffectiveMotion(AnimatorState, Motion)

Sets the effective Motion for the AnimatorState. The Motion is either stored in the AnimatorStateMachine or in the AnimatorLayer's ovverrides. Use this function to set the Motion that is effectively used.

```csharp
public void SetStateEffectiveMotion(AnimatorState state, Motion motion)
```

### Parameters

**** (\[AnimatorState]\(/engine/6000.0/script-reference/unityeditor/animations/animatorstate)): The AnimatorState which we want to set the Motion.**** (\[Motion]\(/engine/6000.0/script-reference/unityengine/motion)): The Motion that will be set.

## SetStateEffectiveMotion(AnimatorState, Motion, int)

Sets the effective Motion for the AnimatorState. The Motion is either stored in the AnimatorStateMachine or in the AnimatorLayer's ovverrides. Use this function to set the Motion that is effectively used.

```csharp
public void SetStateEffectiveMotion(AnimatorState state, Motion motion, int layerIndex)
```

### Parameters

**** (\[AnimatorState]\(/engine/6000.0/script-reference/unityeditor/animations/animatorstate)): The AnimatorState which we want to set the Motion.**** (\[Motion]\(/engine/6000.0/script-reference/unityengine/motion)): The Motion that will be set.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The layer to set the Motion.
