Search Issue Tracker

By Design

Votes

0

Found in

2021.1.12f1

2022.2.0a3

Issue ID

1397724

Regression

No

NavMesh Modifier does not affect NavMesh Surface when NavMesh Surface is created from AI > NavMesh Surface

AI Navigation

-

How to reproduce:
1. Open the user's attached project
2. Create a new NavMesh Surface GameObject in the Hierarchy window (AI > NavMesh Surface)
3. Bake the NavMesh

Expected result: NavMesh Surface is affected by NavMesh Modifiers
Actual result: NavMesh Surface is not affected by NavMesh Modifiers

Reproducible with: 1.0.0-exp.1, 1.0.0-exp.2, 1.0.0-exp.3, 1.0.0-exp.4 (2019.4.37f1, 2020.3.31f1, 2022.2.0a3, 2022.2.0a9)
Not reproducible with: 1.0.0-exp.1, 1.0.0-exp.2, 1.0.0-exp.3, 1.0.0-exp.4 (2021.2.0a7, 2021.2.17f1, 2022.1.0b14, 2022.2.0a2)
Could not test with: 2021.2.0a1 - 2021.2.0a6 (unable to create NavMesh Surface GameObject)

Notes:
- NavMesh Modifiers are located in "WaterCube" and "TerrainTool" GameObjects
- Using an Empty GameObject with a NavMesh Surface component does not reproduce the issue

  1. Resolution Note (2022.2.X):

    Hi! This was a weird one but we’ve found the issue.

    ---

    The problem:

    The root issue derives from the project having two copies of the Nav package:
    -One being likely from Git (Assets/NavMeshComponents)
    -One from the Package manager (Packages/AI Navigation)

    The Git one is likely out of date, and there’s conflict with the dual namespaces.

    The outdated NavMeshSurfaces created with the outdated git package won’t show the field called “Minimum Region Area”:
    -This is normally found on this component under the Advanced drop-down, between Tile Size and Build Heightmesh.
    -You can see this proper component in your project already if you add a fresh NavMeshSurface component through Add Component. If you create a fresh project and import (just) the package, you'll always see this field and it'll function correctly.

    This was the field that gave away the discrepancy when surfaces would work or not based on how they were created, following the repro steps! This field was added in a later version.

    ---

    The Solution:

    1. First, back up your project!
    Deleting references like this is always sketchy, but in my testing, your data should be preserved. But back it up just in case!

    2. Delete the folder Assets/NavMeshComponents
    The Git is no longer supported, but we do support the package.
    We’ll have to fix a few errors that come from this.

    3. Two scripts will have errors: LevelGenerator.cs and TestNavBuildings.cs
    Fix them by adding this line to the top section:
    "using Unity.AI.Navigation;"

    4. The project should now compile, but the NavMeshSurfaces will be missing their script.
    You can search for and find the new NavMeshSurface, found here:
    Packages/com.unity.ai.navigation/Runtime/NavMeshSurface.cs
    Note that the search, by default, only looks in /Assets/
    You can drag this NavMeshSurface onto the missing script field for each of the two Surfaces and they should retain their data.

    After this, the project should be on the proper Nav package and back to fully functional! The Surfaces should now bake and properly include NavMeshModifier overrides.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.