To enable pathfinding on water in Unity, you need to use Unity's built-in navigation system and set up your scene accordingly.
First, you need to set up Unity's Navigation Window by going to Window > AI > Navigation:
Once you have the Navigation Window open, select the water surface in your scene and mark it as a NavMesh Obstacle component:
main.cs265 chars4 lines
After marking the water as an obstacle, you need to bake the NavMesh by clicking on the "Bake" button in the Navigation Window:
This will generate navigation nodes around the water surface so that your agents can navigate through it.
Finally, to have your agents navigate on the water surface using the NavMesh, you need to set their navigation type to "Car" and enable "Obstacle Avoidance" in their NavMesh Agent component:
main.cs442 chars7 lines
With these steps, you should now have your agents successfully navigating on water in Unity using the NavMesh system.
gistlibby LogSnag