Свойство | Тип | Описание | |
---|---|---|---|
syncObjects | List |
Метод | Описание | |
---|---|---|
ClearAllDirtyBits ( ) : void |
This clears all the dirty bits that were set on this script by SetDirtyBits(); This is automatically invoked when an update is sent for this object, but can be called manually as well.
|
|
IsDirty ( ) : bool | ||
OnDeserialize ( Mirror.NetworkReader reader, bool initialState ) : void |
Virtual function to override to receive custom serialization data. The corresponding function to send serialization data is OnSerialize().
|
|
OnSerialize ( Mirror.NetworkWriter writer, bool initialState ) : bool |
Virtual function to override to send custom serialization data. The corresponding function to send serialization data is OnDeserialize(). The initialState flag is useful to differentiate between the first time an object is serialized and when incremental updates can be sent. The first time an object is sent to a client, it must include a full state snapshot, but subsequent updates can save on bandwidth by including only incremental changes. Note that SyncVar hook functions are not called when initialState is true, only for incremental updates. If a class has SyncVars, then an implementation of this function and OnDeserialize() are added automatically to the class. So a class that has SyncVars cannot also have custom serialization functions. The OnSerialize function should return true to indicate that an update should be sent. If it returns true, then the dirty bits for that script are set to zero, if it returns false then the dirty bits are not changed. This allows multiple changes to a script to be accumulated over time and sent when the system is ready, instead of every frame. |
|
OnStartAuthority ( ) : void |
This is invoked on behaviours that have authority, based on context and This is called after When
|
|
OnStartClient ( ) : void |
Called on every NetworkBehaviour when it is activated on a client. Objects on the host have this function called, as there is a local client on the host. The values of SyncVars on object are guaranteed to be initialized correctly with the latest state from the server when this function is called on the client.
|
|
OnStartLocalPlayer ( ) : void |
Called when the local player object has been set up. This happens after OnStartClient(), as it is triggered by an ownership message from the server. This is an appropriate place to activate components or functionality that should only be active for the local player, such as cameras and input.
|
|
OnStartServer ( ) : void |
This is invoked for NetworkBehaviour objects when they become active on the server. This could be triggered by NetworkServer.Listen() for objects in the scene, or by NetworkServer.Spawn() for objects that are dynamically created. This will be called for objects on a "host" as well as for object on a dedicated server.
|
|
OnStopAuthority ( ) : void |
This is invoked on behaviours when authority is removed. When NetworkIdentity.RemoveClientAuthority is called on the server, this will be called on the client that owns the object.
|
|
OnStopClient ( ) : void |
This is invoked on clients when the server has caused this object to be destroyed. This can be used as a hook to invoke effects or do client specific cleanup.
|
|
OnStopServer ( ) : void |
Invoked on the server when the object is unspawned Useful for saving object data in persistent storage
|
|
SerializeObjectsAll ( NetworkWriter writer ) : bool | ||
SerializeObjectsDelta ( NetworkWriter writer ) : bool | ||
SetDirtyBit ( ulong dirtyBit ) : void |
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
|
Метод | Описание | |
---|---|---|
DeserializeSyncVars ( Mirror.NetworkReader reader, bool initialState ) : void | ||
GetSyncVarGameObject ( uint netId, GameObject &gameObjectField ) : GameObject | ||
GetSyncVarNetworkBehaviour ( NetworkBehaviourSyncVar syncNetBehaviour, &behaviourField ) : T | ||
GetSyncVarNetworkIdentity ( uint netId, Mirror.NetworkIdentity &identityField ) : Mirror.NetworkIdentity | ||
InitSyncObject ( Mirror.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 ) : void | ||
SerializeSyncVars ( NetworkWriter writer, bool initialState ) : bool | ||
SetSyncVar ( value, &fieldValue, ulong dirtyBit ) : void | ||
SetSyncVarGameObject ( GameObject newGameObject, GameObject &gameObjectField, ulong dirtyBit, uint &netIdField ) : void | ||
SetSyncVarNetworkBehaviour ( newBehaviour, &behaviourField, ulong dirtyBit, NetworkBehaviourSyncVar &syncField ) : void | ||
SetSyncVarNetworkIdentity ( NetworkIdentity newIdentity, NetworkIdentity &identityField, ulong dirtyBit, uint &netIdField ) : void | ||
SyncVarEqual ( value, &fieldValue ) : bool | ||
SyncVarGameObjectEqual ( GameObject newGameObject, uint netIdField ) : bool | ||
SyncVarNetworkBehaviourEqual ( newBehaviour, NetworkBehaviourSyncVar syncField ) : bool | ||
SyncVarNetworkIdentityEqual ( NetworkIdentity newIdentity, uint netIdField ) : bool | ||
getSyncVarHookGuard ( ulong dirtyBit ) : bool | ||
setSyncVarHookGuard ( ulong dirtyBit, bool value ) : void |
Метод | Описание | |
---|---|---|
AnySyncObjectDirty ( ) : bool | ||
DeSerializeObjectsAll ( Mirror.NetworkReader reader ) : void | ||
DeSerializeObjectsDelta ( Mirror.NetworkReader reader ) : void | ||
DirtyObjectBits ( ) : ulong | ||
ResetSyncObjects ( ) : void |
protected DeserializeSyncVars ( Mirror.NetworkReader reader, bool initialState ) : void | ||
reader | Mirror.NetworkReader | |
initialState | bool | |
Результат | void |
protected GetSyncVarGameObject ( uint netId, GameObject &gameObjectField ) : GameObject | ||
netId | uint | |
gameObjectField | GameObject | |
Результат | GameObject |
protected GetSyncVarNetworkBehaviour ( NetworkBehaviourSyncVar syncNetBehaviour, &behaviourField ) : T | ||
syncNetBehaviour | NetworkBehaviourSyncVar | |
Результат | T |
protected GetSyncVarNetworkIdentity ( uint netId, Mirror.NetworkIdentity &identityField ) : Mirror.NetworkIdentity | ||
netId | uint | |
identityField | Mirror.NetworkIdentity | |
Результат | Mirror.NetworkIdentity |
protected InitSyncObject ( Mirror.SyncObject syncObject ) : void | ||
syncObject | Mirror.SyncObject | |
Результат | void |
public OnDeserialize ( Mirror.NetworkReader reader, bool initialState ) : void | ||
reader | Mirror.NetworkReader | Reader to read from the stream. |
initialState | bool | True if being sent initial state. |
Результат | void |
public OnSerialize ( Mirror.NetworkWriter writer, bool initialState ) : bool | ||
writer | Mirror.NetworkWriter | Writer to use to write to the stream. |
initialState | bool | If this is being called to send initial state. |
Результат | bool |
protected SendCommandInternal ( Type invokeClass, string cmdName, NetworkWriter writer, int channelId, bool ignoreAuthority = false ) : void | ||
invokeClass | Type | |
cmdName | string | |
writer | NetworkWriter | |
channelId | int | |
ignoreAuthority | bool | |
Результат | void |
protected SendRPCInternal ( Type invokeClass, string rpcName, NetworkWriter writer, int channelId, bool excludeOwner ) : void | ||
invokeClass | Type | |
rpcName | string | |
writer | NetworkWriter | |
channelId | int | |
excludeOwner | bool | |
Результат | void |
protected SendTargetRPCInternal ( NetworkConnection conn, Type invokeClass, string rpcName, NetworkWriter writer, int channelId ) : void | ||
conn | NetworkConnection | |
invokeClass | Type | |
rpcName | string | |
writer | NetworkWriter | |
channelId | int | |
Результат | void |
public SerializeObjectsAll ( NetworkWriter writer ) : bool | ||
writer | NetworkWriter | |
Результат | bool |
public SerializeObjectsDelta ( NetworkWriter writer ) : bool | ||
writer | NetworkWriter | |
Результат | bool |
protected SerializeSyncVars ( NetworkWriter writer, bool initialState ) : bool | ||
writer | NetworkWriter | |
initialState | bool | |
Результат | bool |
public SetDirtyBit ( ulong dirtyBit ) : void | ||
dirtyBit | ulong | Bit mask to set. |
Результат | void |
protected SetSyncVar ( value, &fieldValue, ulong dirtyBit ) : void | ||
dirtyBit | ulong | |
Результат | void |
protected SetSyncVarGameObject ( GameObject newGameObject, GameObject &gameObjectField, ulong dirtyBit, uint &netIdField ) : void | ||
newGameObject | GameObject | |
gameObjectField | GameObject | |
dirtyBit | ulong | |
netIdField | uint | |
Результат | void |
protected SetSyncVarNetworkBehaviour ( newBehaviour, &behaviourField, ulong dirtyBit, NetworkBehaviourSyncVar &syncField ) : void | ||
dirtyBit | ulong | |
syncField | NetworkBehaviourSyncVar | |
Результат | void |
protected SetSyncVarNetworkIdentity ( NetworkIdentity newIdentity, NetworkIdentity &identityField, ulong dirtyBit, uint &netIdField ) : void | ||
newIdentity | NetworkIdentity | |
identityField | NetworkIdentity | |
dirtyBit | ulong | |
netIdField | uint | |
Результат | void |
protected SyncVarGameObjectEqual ( GameObject newGameObject, uint netIdField ) : bool | ||
newGameObject | GameObject | |
netIdField | uint | |
Результат | bool |
protected SyncVarNetworkBehaviourEqual ( newBehaviour, NetworkBehaviourSyncVar syncField ) : bool | ||
syncField | NetworkBehaviourSyncVar | |
Результат | bool |
protected SyncVarNetworkIdentityEqual ( NetworkIdentity newIdentity, uint netIdField ) : bool | ||
newIdentity | NetworkIdentity | |
netIdField | uint | |
Результат | bool |
protected getSyncVarHookGuard ( ulong dirtyBit ) : bool | ||
dirtyBit | ulong | |
Результат | bool |
protected setSyncVarHookGuard ( ulong dirtyBit, bool value ) : void | ||
dirtyBit | ulong | |
value | bool | |
Результат | void |