Closed orangeagain closed 2 years ago
Describe the bug AI navigate broken when use "NavMeshComponents" to rebuild navmesh in runtime
To Reproduce Steps to reproduce the behavior (Please include whether this was attempted with "Hosted Mode" or "Dedicated Server Mode"):
attach test runtime script
[RequireComponent(typeof(NavMeshSurface))] public class BakeNavMeshRuntime : MonoBehaviour { public LayerMask IncloudLayers = -1; [SerializeField] NavMeshSurface navMeshSurface; [Header("EditorRuntimeTriger")] public bool BuildNavMeshTriger = false; void Start() { if (navMeshSurface == null) navMeshSurface = GetComponent<NavMeshSurface>(); } void Update() { if (BuildNavMeshTriger) { Debug.Log("Rebuild"); navMeshSurface.layerMask = IncloudLayers; navMeshSurface.BuildNavMesh(); BuildNavMeshTriger = false; } } }
Expected behavior continue navigation like invector shoot scene Screenshots/YouTube Links
Invecot runtime rebuild navmesh:
https://user-images.githubusercontent.com/12761984/170882273-73f6249a-d927-4cd3-8640-6c84a8ac21cb.mp4
EMI runtime rebuild navmesh:
https://user-images.githubusercontent.com/12761984/170882388-3f1df434-417c-4e57-8793-2a0074327282.mp4
Versions
If you can reproduce this issiue, let me know please, thank you
Solved, because AI ground layer need be set
Describe the bug AI navigate broken when use "NavMeshComponents" to rebuild navmesh in runtime
To Reproduce Steps to reproduce the behavior (Please include whether this was attempted with "Hosted Mode" or "Dedicated Server Mode"):
attach test runtime script
Expected behavior continue navigation like invector shoot scene Screenshots/YouTube Links
Invecot runtime rebuild navmesh:
https://user-images.githubusercontent.com/12761984/170882273-73f6249a-d927-4cd3-8640-6c84a8ac21cb.mp4
EMI runtime rebuild navmesh:
https://user-images.githubusercontent.com/12761984/170882388-3f1df434-417c-4e57-8793-2a0074327282.mp4
Versions
If you can reproduce this issiue, let me know please, thank you