Quick Setup
This guide shows you how to add fog of war to your Unity project in a few simple steps.
Setup Steps
1. Create the Scene
- Create a new scene
- Create a plane: GameObject > 3D Object > Plane
- Scale it to your desired map size (e.g., scale
10, 1, 10for a 100×100 world)
2. Create a Sub-Scene
The system uses Unity DOTS, which requires a sub-scene:
- Create an empty GameObject
- Right-click it and select New Sub Scene > Empty Scene...
- Name it "GameWorld"
3. Add FogOfWarManager
- In the main scene, create an empty GameObject named "FogOfWarManager"
- Add the
FogOfWarManagercomponent - Set the map bounds to match your plane:
- For a 100×100 plane: Left
-50, Right50, Bottom-50, Top50
4. Add a Unit with Vision
Inside the sub-scene:
- Create a GameObject (your unit)
- Add
VisionSourceAuthoringcomponent - Set Scale to
(10, 10)for a 10-unit vision radius
5. Test
Enter Play Mode. You should see fog covering everything except around your unit.