NetworkAnimator
Replicates selected Animator parameters from the authoritative worker to clients and ghost workers.
Nebula · Packages/com.1by3.nebula/Runtime/Core/NetworkAnimator.cs[DisallowMultipleComponent]
public class NetworkAnimator : NetworkSyncBehaviourReplicates selected Animator parameters from the authoritative worker to clients and ghost workers. Each copy continues to run its own Animator. Nebula sends changed integer, float, and Boolean parameters; triggers set through SetTrigger; layer state; and transitions. Keyframes give late joiners and new ghosts a complete state. Nebula skips parameters controlled by animation curves and sends animation changes reliably.
With server authority, the worker drives the Animator. When an owning client calls SetTrigger, it asks the worker to set the trigger through a ServerRpc. With owner authority, the owning client drives the Animator and the worker relays its changes.
Fields
SyncParameters
public bool SyncParameters = true;SyncLayerStates
public bool SyncLayerStates = true;SyncLayerWeights
public bool SyncLayerWeights = true;SyncTransitions
public bool SyncTransitions = true;FloatThreshold
public float FloatThreshold = 0.001f;A float parameter must move by at least this much to be sent.
NormalizedTimeResyncThreshold
public float NormalizedTimeResyncThreshold = 0.25f;Keyframes re-sync a looping state's playhead only if it drifted by more than this (normalized time).
DisableRootMotionOnRemote
public bool DisableRootMotionOnRemote = true;Non-authoritative copies do not apply root motion: the entity's pose comes from the network, not the clip.
Properties
Animator
public Animator Animator { get; }Methods
OnNetworkSpawn
public override void OnNetworkSpawn();OnGainedAuthority
public override void OnGainedAuthority();OnLostAuthority
public override void OnLostAuthority();SetTrigger
public void SetTrigger(string name);
public void SetTrigger(int hash);Fire a trigger on every copy. On the authority it fires locally and is replicated; an owning client under server authority forwards the request to the worker, which adds one network round trip of latency.
ResetTrigger
public void ResetTrigger(string name);
public void ResetTrigger(int hash);Reset a trigger locally on this copy. Never replicated (a trigger that was sent is already consumed remotely).
AuthorityTick
protected override void AuthorityTick(uint tick, float deltaTime);WriteSyncState
public override void WriteSyncState(NetworkWriter writer, bool full);OnSyncStateSent
protected internal override void OnSyncStateSent();ReadSyncState
public override void ReadSyncState(NetworkReader reader, uint tick, bool full);