diff --git a/Mirror/Runtime/NetworkBehaviour.cs b/Mirror/Runtime/NetworkBehaviour.cs index ee9fc6a94..e58b7067c 100644 --- a/Mirror/Runtime/NetworkBehaviour.cs +++ b/Mirror/Runtime/NetworkBehaviour.cs @@ -571,6 +571,8 @@ public virtual void OnStopAuthority() { } + // return true when overwriting so that Mirror knows that we wanted to + // rebuild observers ourselves. otherwise it uses built in rebuild. public virtual bool OnRebuildObservers(HashSet observers, bool initialize) { return false; diff --git a/Mirror/Runtime/NetworkProximityChecker.cs b/Mirror/Runtime/NetworkProximityChecker.cs index 6cc3c2546..8e7d2c495 100644 --- a/Mirror/Runtime/NetworkProximityChecker.cs +++ b/Mirror/Runtime/NetworkProximityChecker.cs @@ -56,6 +56,8 @@ public override bool OnCheckObserver(NetworkConnection newObserver) return false; } + // return true when overwriting so that Mirror knows that we wanted to + // rebuild observers ourselves. otherwise it uses built in rebuild. public override bool OnRebuildObservers(HashSet observers, bool initial) { if (forceHidden) @@ -87,7 +89,7 @@ public override bool OnRebuildObservers(HashSet observers, bo observers.Add(uv.connectionToClient); } } - return true; + break; } case CheckMethod.Physics2D: @@ -105,10 +107,11 @@ public override bool OnRebuildObservers(HashSet observers, bo observers.Add(uv.connectionToClient); } } - return true; + break; } } - return false; + + return true; } // called hiding and showing objects on the host