Performance Tips
intermediate performanceTerrain 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
| Recommendation | Details |
|---|---|
| Limit visible cells | For large terrains, use gridCenter and gridScale to display only the area around the player instead of covering the entire terrain. |
| Use power-of-2 columns | Column counts that are powers of 2 (32, 64, 128, 256) enable an optimized pathfinding variant. |
| Minimize territories | Territories add processing overhead. Only enable them when needed, and keep the count reasonable relative to cell count. |
| Pre-warm geometry | Call Redraw() or access grid properties during a loading screen to avoid frame drops when the grid first appears at runtime. |
Inspector Settings
| Setting | Impact | Recommendation |
|---|---|---|
| Roughness | Higher values = more vertices | Keep at minimum unless terrain is very flat |
| Relaxation | Each level re-runs Voronoi calculation | Use sparingly; 1–2 iterations are usually sufficient |
| Curvature | Triples segment count | Only for grids with ≤100 cells |
| Normal Offset | Per-vertex computation | Avoid unless wrapping around complex geometry |
| Show Territories / Colorize | Triggers territory mesh generation | Disable all territory options if not using territories |
Pathfinding Performance
- Use async pathfinding (
FindPathAsync/FindPathAsyncTask) for large grids to avoid frame drops. - Set
maxSearchCostandmaxStepsto limit search scope when full-grid pathfinding is unnecessary. - Use cell groups (
CellSetGroup) combined withcellGroupMaskinFindPathto 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
Resourcesfolder. - 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?
Suggest an improvement
Help us improve this documentation page.