mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
nthybrid: OnServerToClient checks for host mode first to avoid noise!
This commit is contained in:
parent
9271ff5e7b
commit
69ed42e02d
@ -428,6 +428,17 @@ void RpcServerToClientDelta_Rotation(byte baselineTick, Quaternion rotation)
|
||||
// server broadcasts sync message to all clients
|
||||
protected virtual void OnServerToClientDeltaSync(byte baselineTick, Vector3 position, Quaternion rotation)//, Vector3 scale)
|
||||
{
|
||||
// in host mode, the server sends rpcs to all clients.
|
||||
// the host client itself will receive them too.
|
||||
// -> host server is always the source of truth
|
||||
// -> we can ignore any rpc on the host client
|
||||
// => otherwise host objects would have ever growing clientBuffers
|
||||
// (rpc goes to clients. if isServer is true too then we are host)
|
||||
if (isServer) return;
|
||||
|
||||
// don't apply for local player with authority
|
||||
if (IsClientWithAuthority) return;
|
||||
|
||||
// ensure this delta is for our last known baseline.
|
||||
// we should never apply a delta on top of a wrong baseline.
|
||||
if (baselineTick != lastDeserializedBaselineTick)
|
||||
@ -444,17 +455,6 @@ protected virtual void OnServerToClientDeltaSync(byte baselineTick, Vector3 posi
|
||||
return;
|
||||
}
|
||||
|
||||
// in host mode, the server sends rpcs to all clients.
|
||||
// the host client itself will receive them too.
|
||||
// -> host server is always the source of truth
|
||||
// -> we can ignore any rpc on the host client
|
||||
// => otherwise host objects would have ever growing clientBuffers
|
||||
// (rpc goes to clients. if isServer is true too then we are host)
|
||||
if (isServer) return;
|
||||
|
||||
// don't apply for local player with authority
|
||||
if (IsClientWithAuthority) return;
|
||||
|
||||
// Debug.Log($"[{name}] Client: received delta for baseline #{baselineTick}");
|
||||
|
||||
// on the client, we receive rpcs for all entities.
|
||||
|
Loading…
Reference in New Issue
Block a user