My game have two layers, one for drawing maps and props, enemies and the other one for first-person weapon mesh.
The scene structure may look like this:
Root
┗ Map (Layer: Default, Static)
┗ Enemies (Layer: Default, Dynamic)
┗ Player(Layer: Default, Dynamic)
┗━━ Main Camera (Draw every layers, except FirstPerson layer)
┗━━ Weapon Camera (Depth only, draw only FirstPerson layer)
┗━━━━ Weapon (Layer: FirstPerson)
┗━━━━━━━ Muzzleflash (Layer: FirstPerson, has a Particle System, using PointLight to casting light)
The first camera(Main Camera) renders everything except the weapons, and second camera(Weapon Camera) only draws a weapon. Reason for this to prevent the first person weapon meshes passing through the walls and props.
The problem is the muzzleflash in a FirstPerson layer and the level meshes are in Default layer so the casted lightings only affected in the first person meshes(weapon and the arms) and casted lightings to walls and all other map object not display in both cameras.
How do I fix this issue? Have any ideas?