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 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 |
Remarks
When using a distributed authority network topology, this will default to owner authoritative.
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 |