unity
config_error
ai_generated
true
NavMeshObstacle:启用了雕刻模式但障碍物未移动。如果障碍物是静态的,可能会导致性能问题。
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%修复率
85%置信度
1证据数
2023-03-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Unity 2020.3.0f1 | active | — | — | — |
| Unity 2021.3.0f1 | active | — | — | — |
| Unity 2022.3.0f1 | active | — | — | — |
| Unity 2023.2.0f1 | active | — | — | — |
根因分析
NavMeshObstacle 组件在静态对象上启用了雕刻模式,导致不必要的导航网格雕刻更新,从而降低性能。
English
A NavMeshObstacle component has Carve mode enabled on a static object, causing unnecessary navmesh carving updates that degrade performance.
官方文档
https://docs.unity3d.com/Manual/class-NavMeshObstacle.html解决方案
-
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; } }
无效尝试
常见但无效的做法:
-
Disable and re-enable the NavMeshObstacle component at runtime
90% 失败
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% 失败
The warning is about the mode being inappropriate for static objects, not about update frequency.