Class NetworkAnimator
NetworkAnimator enables remote synchronization of Animator state for on network objects.
Implements
Inherited Members
Namespace: Unity.Netcode.Components
Assembly: Unity.Netcode.Components.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
OnAfterDeserialize()
Implement this method to receive a callback after Unity deserializes your object.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
Implement this method to receive a callback before Unity serializes your object.
Declaration
public void OnBeforeSerialize()
OnDestroy()
Invoked when the Game
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 |
OnNetworkDespawn()
Gets called when the Network
Declaration
public override void OnNetworkDespawn()
Overrides
OnNetworkSpawn()
Gets called when the Network
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 |
---|---|---|
Buffer |
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 Set
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 |