Class NetworkAnimator | Multiplayer HLAPI | 1.0.8
docs.unity.cn
    Show / Hide Table of Contents

    Class NetworkAnimator

    A component to synchronize Mecanim animation states for networked objects.

    The animation of game objects can be networked by this component. There are two models of authority for networked movement:

    If the object has authority on the client, then it should animated locally on the owning client. The animation state information will be sent from the owning client to the server, then broadcast to all of the other clients. This is common for player objects.

    If the object has authority on the server, then it should be animated on the server and state information will be sent to all clients. This is common for objects not related to a specific client, such as an enemy unit.

    The NetworkAnimator synchronizes the animation parameters that are checked in the inspector view. It does not automatically sychronize triggers. The function SetTrigger can by used by an object with authority to fire an animation trigger on other clients.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    NetworkBehaviour
    NetworkAnimator
    Inherited Members
    NetworkBehaviour.localPlayerAuthority
    NetworkBehaviour.isServer
    NetworkBehaviour.isClient
    NetworkBehaviour.isLocalPlayer
    NetworkBehaviour.hasAuthority
    NetworkBehaviour.netId
    NetworkBehaviour.connectionToServer
    NetworkBehaviour.connectionToClient
    NetworkBehaviour.playerControllerId
    NetworkBehaviour.syncVarDirtyBits
    NetworkBehaviour.syncVarHookGuard
    NetworkBehaviour.SendCommandInternal(NetworkWriter, Int32, String)
    NetworkBehaviour.InvokeCommand(Int32, NetworkReader)
    NetworkBehaviour.SendRPCInternal(NetworkWriter, Int32, String)
    NetworkBehaviour.SendTargetRPCInternal(NetworkConnection, NetworkWriter, Int32, String)
    NetworkBehaviour.InvokeRPC(Int32, NetworkReader)
    NetworkBehaviour.SendEventInternal(NetworkWriter, Int32, String)
    NetworkBehaviour.InvokeSyncEvent(Int32, NetworkReader)
    NetworkBehaviour.InvokeSyncList(Int32, NetworkReader)
    NetworkBehaviour.RegisterCommandDelegate(Type, Int32, NetworkBehaviour.CmdDelegate)
    NetworkBehaviour.RegisterRpcDelegate(Type, Int32, NetworkBehaviour.CmdDelegate)
    NetworkBehaviour.RegisterEventDelegate(Type, Int32, NetworkBehaviour.CmdDelegate)
    NetworkBehaviour.RegisterSyncListDelegate(Type, Int32, NetworkBehaviour.CmdDelegate)
    NetworkBehaviour.SetSyncVarGameObject(GameObject, GameObject, UInt32, NetworkInstanceId)
    NetworkBehaviour.SetSyncVar<T>(T, T, UInt32)
    NetworkBehaviour.SetDirtyBit(UInt32)
    NetworkBehaviour.ClearAllDirtyBits()
    NetworkBehaviour.PreStartClient()
    NetworkBehaviour.OnNetworkDestroy()
    NetworkBehaviour.OnStartServer()
    NetworkBehaviour.OnStartClient()
    NetworkBehaviour.OnStartLocalPlayer()
    NetworkBehaviour.OnStartAuthority()
    NetworkBehaviour.OnStopAuthority()
    NetworkBehaviour.OnRebuildObservers(HashSet<NetworkConnection>, Boolean)
    NetworkBehaviour.OnSetLocalVisibility(Boolean)
    NetworkBehaviour.OnCheckObserver(NetworkConnection)
    NetworkBehaviour.GetNetworkChannel()
    NetworkBehaviour.GetNetworkSendInterval()
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    UnityEngine.Component.guiText
    Component.networkView
    UnityEngine.Component.guiElement
    UnityEngine.Component.guiTexture
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.Networking
    Syntax
    [DisallowMultipleComponent]
    [AddComponentMenu("Network/NetworkAnimator")]
    [RequireComponent(typeof(NetworkIdentity))]
    [RequireComponent(typeof(Animator))]
    [Obsolete("The high level API classes are deprecated and will be removed in the future.")]
    public class NetworkAnimator : NetworkBehaviour

    Fields

    param0

    Declaration
    public string param0
    Field Value
    Type Description
    String

    param1

    Declaration
    public string param1
    Field Value
    Type Description
    String

    param2

    Declaration
    public string param2
    Field Value
    Type Description
    String

    param3

    Declaration
    public string param3
    Field Value
    Type Description
    String

    param4

    Declaration
    public string param4
    Field Value
    Type Description
    String

    param5

    Declaration
    public string param5
    Field Value
    Type Description
    String

    Properties

    animator

    The animator component to synchronize.

    Declaration
    public Animator animator { get; set; }
    Property Value
    Type Description
    Animator

    Methods

    GetParameterAutoSend(Int32)

    Gets whether an animation parameter should be auto sent.

    Declaration
    public bool GetParameterAutoSend(int index)
    Parameters
    Type Name Description
    Int32 index

    Index of the parameter in the Animator.

    Returns
    Type Description
    Boolean

    True if the parameter should be sent.

    OnDeserialize(NetworkReader, Boolean)

    Declaration
    public override void OnDeserialize(NetworkReader reader, bool initialState)
    Parameters
    Type Name Description
    NetworkReader reader
    Boolean initialState
    Overrides
    NetworkBehaviour.OnDeserialize(NetworkReader, Boolean)

    OnSerialize(NetworkWriter, Boolean)

    Declaration
    public override bool OnSerialize(NetworkWriter writer, bool forceAll)
    Parameters
    Type Name Description
    NetworkWriter writer
    Boolean forceAll
    Returns
    Type Description
    Boolean
    Overrides
    NetworkBehaviour.OnSerialize(NetworkWriter, Boolean)

    SetParameterAutoSend(Int32, Boolean)

    Sets whether an animation parameter should be auto sent.

    Declaration
    public void SetParameterAutoSend(int index, bool value)
    Parameters
    Type Name Description
    Int32 index

    Index of the parameter in the Animator.

    Boolean value

    The new value.

    SetTrigger(Int32)

    Declaration
    public void SetTrigger(int hash)
    Parameters
    Type Name Description
    Int32 hash

    Hash id of trigger (from the Animator).

    SetTrigger(String)

    Causes an animation trigger to be invoked for a networked object.

    If local authority is set, and this is called from the client, then the trigger will be invoked on the server and all clients. If not, then this is called on the server, and the trigger will be called on all clients.

    Declaration
    public void SetTrigger(string triggerName)
    Parameters
    Type Name Description
    String triggerName

    Name of trigger.

    In This Article
    • Fields
      • param0
      • param1
      • param2
      • param3
      • param4
      • param5
    • Properties
      • animator
    • Methods
      • GetParameterAutoSend(Int32)
      • OnDeserialize(NetworkReader, Boolean)
      • OnSerialize(NetworkWriter, Boolean)
      • SetParameterAutoSend(Int32, Boolean)
      • SetTrigger(Int32)
      • SetTrigger(String)
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 15 December 2020