Vision Layers
Vision layers are an optional feature that allows you to control which layers reveal fog of war and which objects can be detected.
Demo Video
See the vision layers system in action in the demonstration video below.
What Are Vision Layers?
The system provides four layer flags (R, G, B, A) that can be configured in the FogOfWarManager. Each layer can represent different floors.
An object is only visible when its VisibilitySwitch layer matches at least one layer flag of a VisionSource.
How to Set Up
1. Configure Layers Texture
In the FogOfWarManager Inspector, you can assign a Layers texture where each color channel (R, G, B, A) defines a separate vision layer on the map:
- R channel = Red layer
- G channel = Green layer
- B channel = Blue layer
- A channel = Alpha layer
This texture allows you to create map regions with different visibility rules. Leave empty if you only want to use component-based layers.
2. Set VisionSource Layer
On each VisionSource component, set the Layer property to define which layers this vision source reveals fog on.
3. Set VisibilitySwitch Layer
On each VisibilitySwitch component, set the Layer property to define on which layers this object can be detected.
Common Use Cases
Use layers to represent different floors in multi-level buildings:
- R Layer = Ground floor (Floor 0)
- G Layer = First floor (Floor 1)
- A Layer = Second floor (Floor 2)
- B Layer = Flying units (Floor 3)
Example:
- Ground units: VisionSource reveals fog only on R layer
- First floor units: VisionSource reveals fog on R and G layers
- Flying units: VisionSource reveals fog on all layers
This creates realistic line-of-sight where ground units can't reveal fog on upper floors, but units on higher floors can reveal fog downward.
Gameplay Benefits
Multi-level environments:
- Tactical advantage from high ground
- Flying units valuable for reconnaissance
Stealth gameplay:
- Hidden units requiring special detection
- Asymmetric visibility mechanics