Class NetworkAnimator
NetworkAnimator enables remote synchronization of Animator state for on network objects.
Implements
Inherited Members
Namespace: Unity.Netcode.Components
Assembly: Unity.Netcode.Runtime.dll
Syntax
[AddComponentMenu("Netcode/Network Animator")]
public class NetworkAnimator : NetworkBehaviour, ISerializationCallbackReceiver
Properties
Animator
Declaration
public Animator Animator { get; set; }
Property Value
Type | Description |
---|---|
Animator |
Methods
Awake()
Declaration
protected virtual void Awake()
OnAfterDeserialize()
Implement this callback to transform data back into runtime data types after an object is deserialized.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
Implement this callback to transform data into serializable data types immediately before an object is serialized.
Declaration
public void OnBeforeSerialize()
OnDestroy()
Invoked when the GameObject the NetworkBehaviour is attached to is destroyed. If you override this, you must always invoke the base class version of this OnDestroy() method.
Declaration
public override void OnDestroy()
Overrides
OnIsServerAuthoritative()
Override this method and return false to switch to owner authoritative mode
Declaration
protected virtual bool OnIsServerAuthoritative()
Returns
Type | Description |
---|---|
bool |
Remarks
When using a distributed authority network topology, this will default to owner authoritative.
OnNetworkDespawn()
Gets called when the NetworkObject gets despawned. This method runs both client and server side.
Declaration
public override void OnNetworkDespawn()
Overrides
OnNetworkSpawn()
Gets called when the NetworkObject gets spawned, message handlers are ready to be registered, and the network is set up.
Declaration
public override void OnNetworkSpawn()
Overrides
OnSynchronize<T>(ref BufferSerializer<T>)
Used to synchronize newly joined clients
Declaration
protected override void OnSynchronize<T>(ref BufferSerializer<T> serializer) where T : IReaderWriter
Parameters
Type | Name | Description |
---|---|---|
BufferSerializer<T> | serializer |
Type Parameters
Name | Description |
---|---|
T |
Overrides
ResetTrigger(int)
Declaration
public void ResetTrigger(int hash)
Parameters
Type | Name | Description |
---|---|---|
int | hash | The hash for the trigger to activate |
ResetTrigger(string)
Resets the trigger for the associated animation. See SetTrigger for more on how triggers are special
Declaration
public void ResetTrigger(string triggerName)
Parameters
Type | Name | Description |
---|---|---|
string | triggerName | The string name of the trigger to reset |
SetTrigger(int, bool)
Sets the trigger for the associated animation
Declaration
public void SetTrigger(int hash, bool setTrigger = true)
Parameters
Type | Name | Description |
---|---|---|
int | hash | The hash for the trigger to activate |
bool | setTrigger | sets (true) or resets (false) the trigger. The default is to set it (true). |
SetTrigger(string)
Sets the trigger for the associated animation
Declaration
public void SetTrigger(string triggerName)
Parameters
Type | Name | Description |
---|---|---|
string | triggerName | The string name of the trigger to activate |