---
tags:
    - "Navigation, NavMesh, AI, Carve, Block"
---

# Nav Mesh Obstacle Carving

[Navigation](../index.md) / [Nav Mesh Obstacle](index.md) / **Nav Mesh Obstacle Carving**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :green_circle: Can Write

</div>

## Description

The Carving property of the Nav Mesh Obstacle 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]
    [Set]

    [Title("Nav Mesh Obstacle Carving")]
    [Category("Navigation/Nav Mesh Obstacle/Carving")]
    [Description("The Carving property of the Nav Mesh Obstacle component")]

    [Image(typeof(IconNavmeshObstacle), ColorTheme.Type.Red)]
    [Keywords("Navigation, NavMesh, AI, Carve, Block")]

    [Serializable]
    public class GenTypeBool_NavMeshObstacle_Carving : TypeBool
    {
        [SerializeField] private GetGameObject m_NavMeshObstacle = new GetGameObject(
            new GenTypeGameObject_NavMeshObstacle()
        );

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

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

        public override bool Get(Args args)
        {
            NavMeshObstacle instance = this.m_NavMeshObstacle.Get<NavMeshObstacle>(args);
            return instance != null
                ? instance.carving
                : default;
        }

        public override void Set(bool value, Args args)
        {
            NavMeshObstacle component = this.m_NavMeshObstacle.Get<NavMeshObstacle>(args);
            if (component != null) component.carving = (bool) value;
        }

        public override string ToString()
        {
            return $"{this.m_NavMeshObstacle} Carving";
        }

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

