RTS Minimap Controller
The RTS Minimap Controller provides a classic top-down minimap for your game. It handles rendering the map, displaying the camera's view frustum, and enabling click-to-move functionality.
Important: This component must be attached to a separate Camera, NOT your Main Camera. This "Minimap Camera" renders to a RenderTexture which is then displayed on your UI.

Features
Top-Down View: Renders an orthographic view of the battlefield.
Click-to-Move: Clicking on the minimap moves the Main Camera to that location instantly.
View Indicator: Draws a trapezoid or rectangle on the minimap showing exactly what the Main Camera sees.
Agent Rendering:
High Quality (Recommended): Supports GPU Instancer Pro to render thousands of actual unit meshes on the minimap efficiently.
Legacy Icons: Can render simple colored shapes (squares/circles) for units if preferred.
Static Background: Can capture a static screenshot of the terrain to save performance, rather than re-rendering the terrain every frame.
Fog of War Support: Hides units and areas that are not visible to the player.
Setup Guide
1. Create the Minimap Camera
Create a new Camera in your scene (GameObject -> Camera).
Name it
MinimapCamera.Set Projection to
Orthographic.Set Rotation to
(90, 0, 0)(looking straight down).Remove the
Audio Listenercomponent.
2. Create the Render Texture
In your Project window, right-click -> Create -> Render Texture.
Name it
MinimapRenderTexture.Set the size (e.g.,
512x512or1024x1024).Assign this texture to the Target Texture slot of your
MinimapCamera.
3. Setup the UI
Create a Raw Image in your Canvas (UI -> Raw Image).
Assign the
MinimapRenderTextureto the Texture slot of the Raw Image.Place this Raw Image where you want the minimap to appear on screen (usually a corner).
4. Configure the Controller
Add the
RTSMinimapControllercomponent to yourMinimapCamera.Main Camera Controller: Assign the
RTSCameraControllerfrom your Main Camera.Minimap Texture: Assign the
MinimapRenderTextureyou created.Minimap UI Rect: Assign the
RectTransformof your UI Raw Image.World Size: Set the width and height of your map (e.g.,
500, 500).World Center: Set the center position of your map (usually
0, 0).
Rendering Agents on Minimap
Option A: Real Meshes (Recommended)
To see your actual units (like tiny soldiers) on the minimap:
Add a GPUI Camera component (from GPU Instancer Pro) to your
MinimapCamera.That's it! The system will automatically render the instanced meshes on this camera too.
Option B: Simple Icons (Legacy)
To use colored squares or circles:
Enable Show Agent Icons in the
RTSMinimapController.Assign the Crowd Controller.
Configure Icon Shape, Size, and Colors.
Note: This uses a dedicated layer (default: 31) to render icons. Ensure your camera culling masks are set correctly.
Performance Optimization
Static Background
Rendering the entire terrain and environment twice (once for Main Camera, once for Minimap) is expensive.
Enable Use Static Background: The controller will take a "screenshot" of the map at startup and use that as a background texture.
Benefit: The Minimap Camera only needs to render moving units, saving massive GPU performance.
Refresh: You can trigger a refresh if the map changes dynamically.
Exclude Layers
Use the Exclude Layers mask to hide expensive effects like Particle Systems, High-Poly Trees, or Post-Processing volumes from the minimap camera.
Key Settings
View Indicator
Show View Indicator: Draws the camera's field of view.
Color/Material: Customize the look of the indicator.
Lock View Indicator Size: Useful if you want a fixed-size box instead of the actual frustum shape.
Player Target
Show Player Target: Displays an icon for your hero or base.
Player Target Icon: Assign a sprite (e.g., a green crosshair or hero face).
Fog of War
Fog Of War Provider: Assign your Fog of War component here.
Hide Non Player Factions: Automatically hides enemy units on the minimap if they are in the fog.
Last updated