> For the complete documentation index, see [llms.txt](https://docs.engagevr.io/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.engagevr.io/developer/creating-locations/network-states/example-network-state-configurations/network-state-animation-control.md).

# Network state animation start/stop

You can use a network state to synchronize animations. The example described on this page expands on the example provided in [Network state toggle object](/developer/creating-locations/network-states/example-network-state-configurations/network-state-toggle-object.md) to synchronize whether an animation plays. With minor adjustments you could also switch between different animations.

To synchronize an object's animation state, you can use the `NetworkStateTrigger_ToggleObjects` script to toggle a target object between enabled and disabled states. You can then use an `OnEnableDoEvent` script on the target object to respond to the enable and disable events.

You can use the `OnEnableDoEvent` script to call any methods on objects in the scene. In this example, the `OnEnableDoEvent` script calls the `StartPlayback` and `StopPlayback` methods of an Animator component.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-9fa518550b5768b41942e562d689d5b54afc3cb1%2Fnet_state_anim_overview.png?alt=media" alt="" width="563"><figcaption><p>Component overview</p></figcaption></figure>

The following diagram shows an example of how to arrange the components in Unity, and the required references.

![Example use of network states to synchronize the playing of an animation](https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2FVieYMwYGNC9Eh9rDlxQb%2Fnetwork_state_anim_toggle.png?alt=media\&token=4f2ba4b6-4cfc-4437-9ed1-79b8e35c689e)

{% hint style="info" %}
To switch between animations that are defined for an object, call the `Play` method of the Animator component, and include either an integer or string parameter that identifies the animation that you want to play. For more information, see [Network state change animation](/developer/creating-locations/network-states/example-network-state-configurations/network-state-change-animation.md).
{% endhint %}
