Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Terrain Manager / Navigation

Terrain Manager / Navigation

Creating a new map using the RTS Engine menu will spawn a pre-made terrain where you can paint textures on it, raise it or lower it and customize it to fit the RTS game you’re creating.

However a Terrain type object is not the only type of object that can server as a map, you can also use multiple tiles, platforms or simply plane objects to serve as the basis of the map.

The Terrain Manager components handles everything terrain-related.

When creating a new map using the RTS Engine menu, this component is attached to an object called ‘TerrainManager’.

  1. Ground Terrain Mask: Specify here the layers that the terrain tiles have. It’s recommended to have one layer for all these tiles to avoid any confusion but having multiple layers is also possible. Just make sure that no other type of object in the map has this layer as well.
  2. Flat Terrain: It can be a simple plane (mesh renderer is also not required to be on the object, it just needs to have a non-trigger collider). It is slightly longer and wider than the actual map. Placed at the center of the map but slightly lower than the main terrain tiles, this object is useful because it acts as the receiver of the raycast when attempting to select multiple units.
  3. Map Size: Approximate size for the map (this can be as simple as the width*height).

Baking the navigation mesh:

When opening the “Navigation” menu (Window -> Navigation) you can see in the Area tab that are three built in areas/layers: “Walkable”, “Not Walkable” and “Jump”.

When switching to the Object tab, the ground terrain object/tiles must be set to “Walkable”.

In the Bake tab, you have a couple of settings to customize the behavior of agents inside the navigation mesh (how you want to go up on hills for example). For more information on this, please check out this page.

Each time you make changes to the map’s terrain, open the “Navigation” menu and bake the terrain again. Make sure that you hide every object in the scene that has a “Nav Mesh Obstacle” component (including resources, default map buildings, etc…) when baking the navmesh to get the most accurate result and then reactivate them again after the baking is done.

How can we help?