Mirror::NetworkAnimator
A component to synchronize Mecanim animation states for networked objects. More...
Inherits from NetworkBehaviour, MonoBehaviour
Public Functions
Name | |
---|---|
virtual override bool | OnSerialize(NetworkWriter writer, bool initialState) Custom Serialization |
virtual override void | OnDeserialize(NetworkReader reader, bool initialState) Custom Deserialization |
void | SetTrigger(string triggerName) Causes an animation trigger to be invoked for a networked object. |
void | SetTrigger(int hash) Causes an animation trigger to be invoked for a networked object. |
void | ResetTrigger(string triggerName) Causes an animation trigger to be reset for a networked object. |
void | ResetTrigger(int hash) Causes an animation trigger to be reset for a networked object. |
Public Attributes
Name | |
---|---|
bool | clientAuthority |
Animator | animator The animator component to synchronize. |
Additional inherited members
Public Functions inherited from NetworkBehaviour
Name | |
---|---|
void | SetDirtyBit(ulong dirtyBit) Used to set the behaviour as dirty, so that a network update will be sent for the object. these are masks, not bit numbers, ie. 0x004 not 2 |
void | ClearAllDirtyBits() This clears all the dirty bits that were set on this script by SetDirtyBits(); |
bool | IsDirty() |
bool | SerializeObjectsAll(NetworkWriter writer) |
bool | SerializeObjectsDelta(NetworkWriter writer) |
virtual void | OnStopClient() This is invoked on clients when the server has caused this object to be destroyed. |
virtual void | OnStartServer() This is invoked for NetworkBehaviour objects when they become active on the server. |
virtual void | OnStopServer() Invoked on the server when the object is unspawned |
virtual void | OnStartClient() Called on every NetworkBehaviour when it is activated on a client. |
virtual void | OnStartLocalPlayer() Called when the local player object has been set up. |
virtual void | OnStartAuthority() This is invoked on behaviours that have authority, based on context and NetworkIdentity.hasAuthority. |
virtual void | OnStopAuthority() This is invoked on behaviours when authority is removed. |
Protected Functions inherited from NetworkBehaviour
Name | |
---|---|
bool | getSyncVarHookGuard(ulong dirtyBit) |
void | setSyncVarHookGuard(ulong dirtyBit, bool value) |
void | InitSyncObject(SyncObject syncObject) |
void | SendCommandInternal(Type invokeClass, string cmdName, NetworkWriter writer, int channelId, bool ignoreAuthority =false) |
void | SendRPCInternal(Type invokeClass, string rpcName, NetworkWriter writer, int channelId, bool excludeOwner) |
void | SendTargetRPCInternal(NetworkConnection conn, Type invokeClass, string rpcName, NetworkWriter writer, int channelId) |
bool | SyncVarGameObjectEqual(GameObject newGameObject, uint netIdField) |
void | SetSyncVarGameObject(GameObject newGameObject, ref GameObject gameObjectField, ulong dirtyBit, ref uint netIdField) |
GameObject | GetSyncVarGameObject(uint netId, ref GameObject gameObjectField) |
bool | SyncVarNetworkIdentityEqual(NetworkIdentity newIdentity, uint netIdField) |
void | SetSyncVarNetworkIdentity(NetworkIdentity newIdentity, ref NetworkIdentity identityField, ulong dirtyBit, ref uint netIdField) |
NetworkIdentity | GetSyncVarNetworkIdentity(uint netId, ref NetworkIdentity identityField) |
bool | SyncVarEqual< T >(T value, ref T fieldValue) |
void | SetSyncVar< T >(T value, ref T fieldValue, ulong dirtyBit) |
virtual bool | SerializeSyncVars(NetworkWriter writer, bool initialState) |
virtual void | DeserializeSyncVars(NetworkReader reader, bool initialState) |
Public Properties inherited from NetworkBehaviour
Name | |
---|---|
NetworkIdentity | netIdentity Returns the NetworkIdentity of this object |
int | ComponentIndex Returns the index of the component on this object |
Protected Properties inherited from NetworkBehaviour
Name | |
---|---|
ulong | syncVarDirtyBits |
Public Attributes inherited from NetworkBehaviour
Name | |
---|---|
SyncMode | syncMode sync mode for OnSerialize |
float | syncInterval sync interval for OnSerialize (in seconds) |
bool | isServer Returns true if this object is active on an active server. |
bool | isClient Returns true if running as a client and this object was spawned by a server. |
bool | isLocalPlayer This returns true if this object is the one that represents the player on the local machine. |
bool | isServerOnly True if this object only exists on the server |
bool | isClientOnly True if this object exists on a client that is not also acting as a server |
bool | hasAuthority This returns true if this object is the authoritative version of the object in the distributed network application. |
uint | netId The unique network Id of this object. |
NetworkConnection | connectionToServer The NetworkConnection associated with this NetworkIdentity. This is only valid for player objects on the client. |
NetworkConnection | connectionToClient The NetworkConnection associated with this NetworkIdentity. This is only valid for player objects on the server. |
Protected Attributes inherited from NetworkBehaviour
Name | |
---|---|
readonly List< SyncObject > | syncObjects objects that can synchronize themselves, such as synclists |
Detailed Description
class Mirror::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 be 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 all animation parameters of the selected Animator. 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.
Public Functions Documentation
function OnSerialize
inline virtual override bool OnSerialize(
NetworkWriter writer,
bool initialState
)
Custom Serialization
Parameters:
- writer
- initialState
Return:
Reimplements: Mirror::NetworkBehaviour::OnSerialize
function OnDeserialize
inline virtual override void OnDeserialize(
NetworkReader reader,
bool initialState
)
Custom Deserialization
Parameters:
- reader
- initialState
Reimplements: Mirror::NetworkBehaviour::OnDeserialize
function SetTrigger
inline void SetTrigger(
string triggerName
)
Causes an animation trigger to be invoked for a networked object.
Parameters:
- triggerName Name of trigger.
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.
function SetTrigger
inline void SetTrigger(
int hash
)
Causes an animation trigger to be invoked for a networked object.
Parameters:
- hash Hash id of trigger (from the Animator).
function ResetTrigger
inline void ResetTrigger(
string triggerName
)
Causes an animation trigger to be reset for a networked object.
Parameters:
- triggerName Name of trigger.
If local authority is set, and this is called from the client, then the trigger will be reset on the server and all clients. If not, then this is called on the server, and the trigger will be reset on all clients.
function ResetTrigger
inline void ResetTrigger(
int hash
)
Causes an animation trigger to be reset for a networked object.
Parameters:
- hash Hash id of trigger (from the Animator).
Public Attributes Documentation
variable clientAuthority
bool clientAuthority;
variable animator
Animator animator;
The animator component to synchronize.
Updated on 21 January 2021 at 19:59:42 UTC