# ResetControllerState(bool)

> Resets the AnimatorController to its default state.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Animations](/engine/6000.7/script-reference/unityengine/animations.md)
* **Assembly:** UnityEngine.AnimationModule

```csharp
public void ResetControllerState(bool resetParameters = true)
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Set to true to also reset the controller parameters to their default values. When set to false, only the controller state is reset.

### Remarks

Use this method to reset the layers in the [AnimatorController](/engine/6000.7/script-reference/unityeditor/animations/animatorcontroller.md) to their default state.

### Examples

```csharp
using System;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Playables;

// Press the Spacebar in Play Mode to reset the AnimatorController to the default state
[RequireComponent(typeof(Animator))]
public class AnimatorControllerPlayableResetExample : MonoBehaviour
{
    // The AnimatorController to be used with the Animator component.
    public RuntimeAnimatorController m_Controller;

    Animator m_Animator;
    AnimatorControllerPlayable m_ControllerPlayable;

    void Start()
    {
        m_Animator = GetComponent<Animator>();

        // Set up the PlayableGraph and AnimatorControllerPlayable and play the graph.
        var graph = PlayableGraph.Create(nameof(AnimatorControllerPlayableResetExample));
        m_ControllerPlayable = AnimatorControllerPlayable.Create(graph, m_Controller);
        var output = AnimationPlayableOutput.Create(graph, nameof(AnimatorControllerPlayableResetExample), m_Animator);
        output.SetSourcePlayable(m_ControllerPlayable);
        graph.Play();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            //This will reset the AnimatorController to the default state.
            m_ControllerPlayable.ResetControllerState();
        }
    }

    void OnDestroy()
    {
        // Destroy the PlayableGraph when the GameObject is destroyed.
        m_ControllerPlayable.GetGraph().Destroy();
    }
}
```
