# IsValid

> Returns true if the node referenced by the specified PolygonId is active in the NavMesh.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Experimental.AI](/engine/6000.7/script-reference/unityengine/experimental/ai.md)
* **Assembly:** UnityEngine.AIModule

## IsValid(PolygonId)

Returns true if the node referenced by the specified [PolygonId](/engine/6000.7/script-reference/unityengine/experimental/ai/polygonid.md) is active in the NavMesh.

> **Warning:**
>
> **Deprecated.** The experimental NavMeshQuery struct has been deprecated. Use NavWorld instead.

```csharp
public bool IsValid(PolygonId polygon)
```

### Parameters

**** (\[PolygonId]\(/engine/6000.7/script-reference/unityengine/experimental/ai/polygonid)): Identifier of the NavMesh node to be checked.

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

You can make NavMesh nodes invalid when you remove the NavMesh surface or the links they belong to, or when you modify the NavMesh in their region, replacing them. You can remove the NavMesh surface and links with calls to [NavMesh.RemoveNavMeshData](/engine/6000.7/script-reference/unityengine/ai/navmesh/removenavmeshdata.md), [NavMesh.RemoveLink](/engine/6000.7/script-reference/unityengine/ai/navmesh/removelink.md). To modify the NavMesh, call  UpdateNavMeshData or use a [NavMeshObstacle](https://docs.unity3d.com/Packages/com.unity.ai.navigation@2.0/manual/NavMeshObstacle.html) to carve it.

## IsValid(NavMeshLocation)

Returns `true` if the node referenced by the [PolygonId](/engine/6000.7/script-reference/unityengine/experimental/ai/polygonid.md) contained in the [NavMeshLocation](/engine/6000.7/script-reference/unityengine/experimental/ai/navmeshlocation.md) is active in the NavMesh.

> **Warning:**
>
> **Deprecated.** The experimental NavMeshQuery struct has been deprecated. Use NavWorld instead.

```csharp
public bool IsValid(NavMeshLocation location)
```

### Parameters

**** (\[NavMeshLocation]\(/engine/6000.7/script-reference/unityengine/experimental/ai/navmeshlocation)): Location on the NavMesh to be checked. Same as checking `location.polygon` directly.

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |
