From 4c1f50119fdf16a646a3230768fd343c4c063711 Mon Sep 17 00:00:00 2001 From: vis2k Date: Fri, 29 Apr 2022 18:48:25 +0800 Subject: [PATCH] NetworkServer: trim newObservers --- Assets/Mirror/Runtime/NetworkServer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkServer.cs b/Assets/Mirror/Runtime/NetworkServer.cs index 4d225e39b..f8d83cc47 100644 --- a/Assets/Mirror/Runtime/NetworkServer.cs +++ b/Assets/Mirror/Runtime/NetworkServer.cs @@ -1504,8 +1504,10 @@ static void RebuildObserversCustom(NetworkIdentity identity, bool initialize) newObservers.Add(identity.connectionToClient); } - // TODO cap - + // cap to maxObservers before handling added/removed. + // this is 100% safe and allows us to limit local world size + // without worrying about observers+fitted observers for Rpcs etc. + newObservers.Trim(maxObservers); bool changed = false;