Performance Tips

intermediate performance

Terrain Grid System 2 · Troubleshooting & FAQ

Performance Tips

Terrain Grid System 2 is highly optimized, but large grids or complex setups benefit from these guidelines.

Grid Size and Cell Count

RecommendationDetails
Limit visible cellsFor large terrains, use gridCenter and gridScale to display only the area around the player instead of covering the entire terrain.
Use power-of-2 columnsColumn counts that are powers of 2 (32, 64, 128, 256) enable an optimized pathfinding variant.
Minimize territoriesTerritories add processing overhead. Only enable them when needed, and keep the count reasonable relative to cell count.
Pre-warm geometryCall Redraw() or access grid properties during a loading screen to avoid frame drops when the grid first appears at runtime.

Inspector Settings

SettingImpactRecommendation
RoughnessHigher values = more verticesKeep at minimum unless terrain is very flat
RelaxationEach level re-runs Voronoi calculationUse sparingly; 1–2 iterations are usually sufficient
CurvatureTriples segment countOnly for grids with ≤100 cells
Normal OffsetPer-vertex computationAvoid unless wrapping around complex geometry
Show Territories / ColorizeTriggers territory mesh generationDisable all territory options if not using territories

Pathfinding Performance

  • Use async pathfinding (FindPathAsync / FindPathAsyncTask) for large grids to avoid frame drops.
  • Set maxSearchCost and maxSteps to limit search scope when full-grid pathfinding is unnecessary.
  • Use cell groups (CellSetGroup) combined with cellGroupMask in FindPath to restrict search to relevant areas.
  • Use CancelPathFindingAsync() to abort long-running async operations when results are no longer needed.

Rendering Tips

  • Use far fade (farFadeEnabled, farFadeDistance) to avoid rendering distant grid lines.
  • Use circular fade (circularFadeEnabled, circularFadeTarget) to show the grid only around the player.
  • Prefer Overlay Mode over Ground mode when visual precision is not critical — it avoids depth-buffer complexity.

Build Tips

  • Ensure only the shaders used by your grid configuration are included in the build. TGS shaders are located in the asset’s Resources folder.
  • If using URP, disable Depth Priming Mode in the Universal Renderer to prevent rendering issues.
  • On mobile platforms, prefer box topology with moderate cell counts (under 10,000) for smooth frame rates.
Was this page helpful?