From 71adefdb9053c0ebabe4fd3c02fe8251ff39bbf0 Mon Sep 17 00:00:00 2001 From: mischa <16416509+miwarnec@users.noreply.github.com> Date: Fri, 29 Nov 2024 15:47:57 +0100 Subject: [PATCH] Update InterestManagementBase.cs --- Assets/Mirror/Core/InterestManagementBase.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/Mirror/Core/InterestManagementBase.cs b/Assets/Mirror/Core/InterestManagementBase.cs index c358097d73..1a3cc1b356 100644 --- a/Assets/Mirror/Core/InterestManagementBase.cs +++ b/Assets/Mirror/Core/InterestManagementBase.cs @@ -47,6 +47,14 @@ public virtual void SetHostVisibility(NetworkIdentity identity, bool visible) foreach (Renderer rend in identity.GetComponentsInChildren()) rend.enabled = visible; + // reason to also set lights/audio/terrain/etc.: + // Let's say players were holding a flashlight or magic wand with a particle effect. Without this, + // host client would see the light / particles for all players in all subscenes because we don't + // hide lights and particles. Host client would hear ALL audio sources in all subscenes too. We + // hide the renderers, which covers basic objects and UI, but we don't hide anything else that may + // be a child of a networked object. Same idea for cars with lights and sounds in other subscenes + // that host client shouldn't see or hear...host client wouldn't see the car itself, but sees the + // lights moving around and hears all of their engines / horns / etc. foreach (Light light in identity.GetComponentsInChildren()) light.enabled = visible;