Table of Contents

Minimap Generation


Minimap generation produces a fog texture you can draw on top of a UI map, so players can see explored areas and unit line of sight on their map.

Important

The minimap requires a fog texture, so you must set World Bounds to map the texture to your world.

Setup

  1. Enable Use Mini Map on the Fog Of War World.
  2. Define your World Bounds.
  3. Provide the fog texture to your UI in one of two ways:
    • Assign a reference to a UI Raw Image on the Fog Of War World, or
    • Fetch the texture in code with GetFOWRT() and apply it to your own map material/UI.

Minimap texture generation

Texture Resolution

The fog texture resolution is controlled by Fow Res X and Fow Res Y. Higher resolutions look sharper on the map but use more memory.

In Code

using FOW;
using UnityEngine;
using UnityEngine.UI;

public class MinimapBinder : MonoBehaviour
{
    public RawImage minimapImage;

    void Start()
    {
        minimapImage.texture = FogOfWarWorld.instance.GetFOWRT();
    }
}

Unit Icons

You can draw icons on top of the minimap to track units — their positions update automatically each frame from their world positions.

  1. Add a Mini Map Icon Manager component to your map UI. Assign:
    • Map Image Component — the UI Image the icons are parented to (your minimap).
    • Icon Prefab — a UI Image prefab used for each icon.
    • Initial Max Capacity — how many icons to pre-pool (auto-expands if exceeded).
  2. Add a Mini Map Tracker Object component to any unit you want to appear on the map, and set its Icon Scale, Icon Color, and Icon Texture. The unit registers and unregisters itself automatically.
Tip

Mini Map Tracker Object is a simple example you can replace with your own logic. To drive icons yourself, call MiniMapIconManager.instance.TrackNewObject(transform, scale, color, sprite) and StopTrackingObject(transform).

There is also a small Set Mini Map Image helper component that assigns the fog texture to a UI RawImage on Start, if you'd rather not call GetFOWRT() yourself.