unity
config_error
ai_generated
true
NavMeshObstacle: Carve mode is enabled but the obstacle is not moving. This may cause performance issues if the obstacle is static.
ID: unity/navmesh-obstacle-carve-not-moving
95%Fix Rate
85%Confidence
1Evidence
2023-03-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Unity 2020.3.0f1 | active | — | — | — |
| Unity 2021.3.0f1 | active | — | — | — |
| Unity 2022.3.0f1 | active | — | — | — |
| Unity 2023.2.0f1 | active | — | — | — |
Root Cause
A NavMeshObstacle component has Carve mode enabled on a static object, causing unnecessary navmesh carving updates that degrade performance.
generic中文
NavMeshObstacle 组件在静态对象上启用了雕刻模式,导致不必要的导航网格雕刻更新,从而降低性能。
Official Documentation
https://docs.unity3d.com/Manual/class-NavMeshObstacle.htmlWorkarounds
-
95% success Disable Carve mode on static obstacles: Select the GameObject, in the NavMeshObstacle component, uncheck 'Carve'. Use this code snippet to automate: GetComponent<NavMeshObstacle>().carving = false;
Disable Carve mode on static obstacles: Select the GameObject, in the NavMeshObstacle component, uncheck 'Carve'. Use this code snippet to automate: GetComponent<NavMeshObstacle>().carving = false;
-
85% success If the obstacle is intended to move, attach a script that toggles carving on movement: void Update() { if (transform.hasChanged) { GetComponent<NavMeshObstacle>().carving = true; } else { GetComponent<NavMeshObstacle>().carving = false; } }
If the obstacle is intended to move, attach a script that toggles carving on movement: void Update() { if (transform.hasChanged) { GetComponent<NavMeshObstacle>().carving = true; } else { GetComponent<NavMeshObstacle>().carving = false; } }
中文步骤
Disable Carve mode on static obstacles: Select the GameObject, in the NavMeshObstacle component, uncheck 'Carve'. Use this code snippet to automate: GetComponent<NavMeshObstacle>().carving = false;
If the obstacle is intended to move, attach a script that toggles carving on movement: void Update() { if (transform.hasChanged) { GetComponent<NavMeshObstacle>().carving = true; } else { GetComponent<NavMeshObstacle>().carving = false; } }
Dead Ends
Common approaches that don't work:
-
Disable and re-enable the NavMeshObstacle component at runtime
90% fail
This does not change the Carve mode setting and the static obstacle still triggers carving warnings.
-
Increase the carving update interval in NavMesh settings
85% fail
The warning is about the mode being inappropriate for static objects, not about update frequency.