skip to Main Content

How to add the grid to your scene

Table of Contents

In Unity Editor

There’re 3 ways to add Terrain Grid System to the scene in Editor time:

  1. If you’re using Terrain Grid System for 2D (not terrain based) select the menu GameObject -> 3D Object -> Terrain Grid System and the grid will be added to the scene.

  2. If you wish to add a grid to a Terrain or other gameobjects like mesh-based terrains, just select your terrain or root of gameobjects and add the script “Terrain Grid System”. It will configure automatically for you.

  3. Alternatively, you can drag the prefab “TerrainGridSystem” from “Resources/Prefabs” folder to your scene and assign your terrain or gameobject to the Terrain property.

Once created, select the GameObject created to show custom properties and assign the terrain gameobject reference.

At runtime

You can also add Terrain Grid System dynamically in Play Mode in 2 ways:

  1. Call AddTerrainGridSystem() method on your terrain or gameobject. Example:

TerrainGridSystem tgs = myTerrainGameObject.AddTerrainGridSystem();

Where myTerrainGameObject is the gameobject where your terrain is or any other gameobject is you use mesh-based terrain.

  1. Or instantiate the “TerrainGridSystem” prefab from “Resources/Prefabs” and call SetTerrain(your terrain gameobject) form script.

Back To Top