Network state animation control
You can use a network state to synchronize animations. The example shown in the diagrams synchronizes whether an animation plays. This example uses the Animator component. With minor adjustments you could also synchronize a switch between different animations that are defined for an object.
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 a 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.
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.
Last updated