# AnimatorCullingMode

> The culling mode for an Animator.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AnimationModule

```csharp
public enum AnimatorCullingMode
```

## Remarks

To specify how an Animator manages animations for objects that might not be visible, set a value from this enum to [Animator.cullingMode](/engine/6000.6/script-reference/unityengine/animator/cullingmode.md).

```csharp
using UnityEngine;

// This example demonstrates how to change the culling mode of an Animator component based on the distance between the
// object and the main camera. This can be useful to optimize performance by disabling animations when objects are far
// away from the camera.
[RequireComponent(typeof(Animator))]
public class AnimatorCullingModeExample : MonoBehaviour
{
    // The distance at which the Animator culling mode is set to CullCompletely.
    public float distanceToEnableCulling = 100.0f;

    Animator m_Animator;

    void Start()
    {
        m_Animator = GetComponent<Animator>();
        m_Animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;

        if (Camera.main == null)
        {
            Debug.LogError("There is no main camera in the scene.");
        }
    }

    void Update()
    {
        if (Camera.main == null)
        {
            return;
        }

        // Check the distance between the object and the camera.
        if (Vector3.Distance(transform.position, Camera.main.transform.position) < distanceToEnableCulling)
        {
            m_Animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
        }
        else
        {
            m_Animator.cullingMode = AnimatorCullingMode.CullCompletely;
        }
    }
}
```

Additional Resources: [Animator.cullingMode](/engine/6000.6/script-reference/unityengine/animator/cullingmode.md).

## Fields

| Value                                                                                                           | Description                                                                       |
| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| [AlwaysAnimate](/engine/6000.6/script-reference/unityengine/animatorcullingmode/alwaysanimate.md)               | Always animate the entire character. Object is animated even when offscreen.      |
| [CullCompletely](/engine/6000.6/script-reference/unityengine/animatorcullingmode/cullcompletely.md)             | Animation is completely disabled when renderers are not visible.                  |
| [CullUpdateTransforms](/engine/6000.6/script-reference/unityengine/animatorcullingmode/cullupdatetransforms.md) | Retarget, IK and write of Transforms are disabled when renderers are not visible. |
