Skip to content

Commit

Permalink
Update InterestManagementBase.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
miwarnec authored Nov 29, 2024
1 parent 3c1f301 commit 71adefd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Assets/Mirror/Core/InterestManagementBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public virtual void SetHostVisibility(NetworkIdentity identity, bool visible)
foreach (Renderer rend in identity.GetComponentsInChildren<Renderer>())
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>())
light.enabled = visible;

Expand Down

0 comments on commit 71adefd

Please sign in to comment.