How to show navmesh in Game?

I want to draw navmesh as an image on interface in game. Can it be done and How?

Thanks in advance.

You can use NavMesh triangulation:

void Start() {
    triangulation = NavMesh.CalculateTriangulation();

void OnPostRender() {
    if (material == null) {

    for (int i = 0; i < triangulation.indices.Length; i += 3) {
        var triangleIndex = i / 3;
        var i1 = triangulation.indices*;*

var i2 = triangulation.indices[i + 1];
var i3 = triangulation.indices[i + 2];
var p1 = triangulation.vertices[i1];
var p2 = triangulation.vertices[i2];
var p3 = triangulation.vertices[i3];
var areaIndex = triangulation.areas[triangleIndex];
Color color;
switch (areaIndex) {
case 0:
color = walkableColor; break;
case 1:
color = nonWalkableColor; break;
color = unknownColor; break;

That draws navmesh in a world scene. To draw on a image, I guess you need to construct a [Mesh][1] from this triangulation in a similar way, and then render it to a [RenderTexture][2]. For that you need to place a mesh with triangulation off your main scene view and put a camera (different from your main camera) to look at the mesh in a way you need. Then you assign this camera to a RenderTexture, and use some Material with this texture for your image.
Scripts with OnPostRender() function [must be placed on Camera object to work][3]
[1]: Unity - Scripting API: Mesh
[2]: Unity - Manual: Render Texture
[3]: Unity - Scripting API: MonoBehaviour.OnPostRender()

There may be a better solution, but i think you can do this by using the navmesh triangulation and drawing the triangles with GL

You will need to retrieve mesh data from NavMesh.CalculateTriangulation() and chuck it into GL or a GameObject’s Mesh Filter. The above posters covered the GL method, here’s an article covering the Mesh Filter / Mesh Renderer method, which also gives you more control over your object in the Inspector: Showing Unity’s NavMesh in-game — Terresquall Blog