[NGO] Networked Spot Light Not Visible on Remote Clients
Solution
Unity 2021.3.x - Unity 6.3.x
Published 18 days ago
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.
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.
- Replace the boolean toggle logic with a
NetworkVariable<bool>to ensure the state is persisted across the network and synchronized for all joining players. - Subscribe to the
OnValueChangedcallback of the NetworkVariable withinOnNetworkSpawnto trigger theenabledstate of theLightcomponent immediately upon object creation. - Navigate to the
Lightcomponent inspector and set theRender Modeto Important. This forces the light to be rendered as a per-pixel light, preventing it from being culled by theQuality Settingspixel light count limit on different hardware. - Confirm that your script does not have a
NetworkBehaviourconflict whereIsOwnerchecks are inadvertently preventing the rendering logic from executing on non-owner clients.
Additional Tips
- Verify that the
Shadow Typeis not set toNo Shadowsif your scene logic relies on shadow casting for visibility. - Ensure the
Layerof theLightis included in theCulling Maskof theCameraon all client prefabs. - If using URP, check the
Universal Render Pipeline Assetto ensure theMax Additional Lightscount 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.