---
tags:
    - "Navigation, NavMesh, AI, Pathfinding, Agent"
---

# Nav Mesh Agent Is On Nav Mesh

[Navigation](../index.md) / [Nav Mesh Agent](index.md) / **Nav Mesh Agent Is On Nav Mesh**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The Is On Nav Mesh property of the Nav Mesh Agent component

## Code

```cs
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.AI;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Nav Mesh Agent Is On Nav Mesh")]
    [Category("Navigation/Nav Mesh Agent/Is On Nav Mesh")]
    [Description("The Is On Nav Mesh property of the Nav Mesh Agent component")]

    [Image(typeof(IconNavmeshAgent), ColorTheme.Type.Red)]
    [Keywords("Navigation, NavMesh, AI, Pathfinding, Agent")]

    [Serializable]
    public class GenTypeBool_NavMeshAgent_IsOnNavMesh : TypeBool
    {
        [SerializeField] private GetGameObject m_NavMeshAgent = new GetGameObject(
            new GenTypeGameObject_NavMeshAgent()
        );

        public override bool GetPreview(GameObject source)
        {
            GameObject instance = this.m_NavMeshAgent.GetPreview(source);
            if (instance == null) return default;

            NavMeshAgent component = instance.GetComponent<NavMeshAgent>();
            return component != null ? component.isOnNavMesh : default;
        }

        public override bool Get(Args args)
        {
            NavMeshAgent instance = this.m_NavMeshAgent.Get<NavMeshAgent>(args);
            return instance != null
                ? instance.isOnNavMesh
                : default;
        }

        public override string ToString()
        {
            return $"{this.m_NavMeshAgent} Is On Nav Mesh";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
```

