UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

graphics

[NGO] Networked Spot Light Not Visible on Remote Clients

Solution

networkinggraphicslightingmultiplayer

Unity 2021.3.x - Unity 6.3.x

Published 18 days ago

Issue

 A networked Light component, specifically a spot light, fails to render on remote client instances even when logs confirm the enabled property is true. Despite correct Culling Mask and Layer configurations, the light only appears on the local owner or the server, leading to synchronization discrepancies in multiplayer environments.

Explanation

The most common reason a Light appears enabled in logic but invisible in the viewport on remote clients is a failure in state synchronization for late-joiners or a race condition during NetworkObject initialization. Relying exclusively on ClientRpc calls means any client joining after the RPC is fired will never receive the state change.

  1. Replace the boolean toggle logic with a NetworkVariable<bool> to ensure the state is persisted across the network and synchronized for all joining players.
  2. Subscribe to the OnValueChanged callback of the NetworkVariable within OnNetworkSpawn to trigger the enabled state of the Light component immediately upon object creation.
  3. Navigate to the Light component inspector and set the Render Mode to Important. This forces the light to be rendered as a per-pixel light, preventing it from being culled by the Quality Settings pixel light count limit on different hardware.
  4. Confirm that your script does not have a NetworkBehaviour conflict where IsOwner checks are inadvertently preventing the rendering logic from executing on non-owner clients.

Additional Tips

  • Verify that the Shadow Type is not set to No Shadows if your scene logic relies on shadow casting for visibility.
  • Ensure the Layer of the Light is included in the Culling Mask of the Camera on all client prefabs.
  • If using URP, check the Universal Render Pipeline Asset to ensure the Max Additional Lights count is high enough to support multiple networked spot lights in one area.

TL;DR

Resolve light visibility issues by transitioning from transient RPC calls to a persistent NetworkVariable and ensuring the Render Mode is prioritized for networked objects.


Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.