Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Third Party Support
  4. Fog Of War

Fog Of War

This documentation page includes instructions on how to integrate BrendanL.K’s Fog Of War asset and the RTS Engine and how to make them work together.

Fog Of War copyright © BrendanL.K.

Required asset versions:

  • Fog Of War: v1.18 or higher.
  • RTS Engine: v1.5.7 or higher


Integration Pack download

Integration Instructions:

Import Files:

Make sure that both the RTS Engine and the Fog Of War are already in your Unity project. Then download the integration pack using the above link and import it to the project. Open Player Settings and add “RTSENGINE_FOW” to the Scripting Define Symbols under Other Settings -> Configurations.

Set up a map/scene:

Create a new empty object in the map, call it “FoWManager” and add the following two components to it:

  1. Fog Of War Team: A component from the fog of war asset, for more information regarding options/fields of that component, please check the fog of war asset documentation (PDF file available when importing the asset).
  2. Fog Of War RTS Manager: A component from the RTS Engine fog of war integration package:
    1. Free Buildings Visible: When enabled, all free buildings (that do not belong to any faction) will be visible to all factions in the fog.
    2. Minimum Building Placement Fog Strength: A value between 0.0 and 1.0 that determines the minimum strength of the fog required to have in an area so the player is able to place a building in that area. (0.0 means that the area is completely hidden by fog and 1.0 means that the area is completely visible).
    3. Check Prefabs for Fog of War components: Click this button and the unit, building and resource prefabs (that are placed within a path that ends with Resources/Prefabs/) will be scanned for the fog of war components that need to be attache to them. Any prefab that has a missing fog of war related component will trigger an error message in the console with the missing component.

Next, add the FogOfWarLegacy component to both the main and minimap cameras. For more information regarding options/fields of this component, please check the fog of war asset documentation.

Configuring units, buildings and resources:

Add the FogOfWarUnit component to the main object of each unit and building prefab and make sure it is disabled by default (do not add this component for resources). For more information regarding options/fields of this component, please check the fog of war asset documentation.

Now add the HideInFogRTS component to the selection object of each unit, building and resource prefab.

  1. Min Fog Strength: Must be between 0.0 and 1.0. This defines the strength of the fog at which units and buildings from non-player factions and resources that are not in a visible area are visible to the player.
  2. Visible Post Discovery: When enabled, then the object associated to this component will remain visible when it first gets discovered (enters a visible area) even if it’s not in a completely visible area later.
  3. Same Visibility Objects: Drag and drop child objects to the main unit, building or resource parent object that this component is associated to it into this field if you want to determine their visibility status depending on the visibility status determined by this component.

How can we help?