mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkIdentity: move update methods next to each other
This commit is contained in:
parent
f32ac7dfe6
commit
70f1fe8c5b
@ -629,25 +629,6 @@ internal void HandleRPC(int componentIndex, int rpcHash, NetworkReader reader)
|
||||
HandleRemoteCall(componentIndex, rpcHash, UNetInvokeType.ClientRpc, reader);
|
||||
}
|
||||
|
||||
// invoked by unity runtime immediately after the regular "Update()" function.
|
||||
internal void UNetUpdate()
|
||||
{
|
||||
if (observers.Count == 0)
|
||||
return;
|
||||
|
||||
// serialize all the dirty components and send (if any were dirty)
|
||||
byte[] payload = OnSerializeAllSafely(false);
|
||||
if (payload != null)
|
||||
{
|
||||
// construct message and send
|
||||
UpdateVarsMessage message = new UpdateVarsMessage();
|
||||
message.netId = netId;
|
||||
message.payload = payload;
|
||||
|
||||
NetworkServer.SendToReady(gameObject, (short)MsgType.UpdateVars, message);
|
||||
}
|
||||
}
|
||||
|
||||
internal void OnUpdateVars(NetworkReader reader, bool initialState)
|
||||
{
|
||||
if (initialState && m_NetworkBehaviours == null)
|
||||
@ -946,6 +927,25 @@ internal void Reset()
|
||||
m_ClientAuthorityOwner = null;
|
||||
}
|
||||
|
||||
// invoked by unity runtime immediately after the regular "Update()" function.
|
||||
internal void UNetUpdate()
|
||||
{
|
||||
if (observers.Count == 0)
|
||||
return;
|
||||
|
||||
// serialize all the dirty components and send (if any were dirty)
|
||||
byte[] payload = OnSerializeAllSafely(false);
|
||||
if (payload != null)
|
||||
{
|
||||
// construct message and send
|
||||
UpdateVarsMessage message = new UpdateVarsMessage();
|
||||
message.netId = netId;
|
||||
message.payload = payload;
|
||||
|
||||
NetworkServer.SendToReady(gameObject, (short)MsgType.UpdateVars, message);
|
||||
}
|
||||
}
|
||||
|
||||
// this is invoked by the UnityEngine
|
||||
public static void UNetStaticUpdate()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user