NavMesh building components provide you with ability to create navigation meshes that are generated automatically from your Scene geometry, which allows characters to move intelligently around the game world.
Unity NavMesh 2D Pathfinding
This repo is a proof of concept of Unity NavMesh and Pathfinding in 2D. It is explores NavMeshComponents capabilities. (https://docs.unity3d.com/Manual/class-NavMeshSurface.html)
You can use this in two different ways: downloading this repository or adding it to your project's Package Manager manifest.
Alternatively, you can pick scripts and place in your project's
Variant 1. Download
Download or clone this repository into your project in the folder
Variant 2. Package Manager Manifest
Git must be installed and added to your path.
The following line needs to be added to your
Packages/manifest.json file in your Unity Project under the
In repo you will find implementation of NavMeshSurface2d for tilemap top down games.
To use it in your project:
- Copy repo into your Asset folder
- Create Empty Object in scene root and rotated respectively to Tilemap (x-90;y0;z0)
- Add NavMeshSurface2d component to Empty Object
- Add Tilemap with NavMeshModifier component, override the area.
- In NavMeshSurface2d hit Bake.
How does it works:
- It uses https://docs.unity3d.com/Manual/class-NavMeshSurface.html as base implementation.
- Implements world bound calculation from Tilemap bounds.
- Implements source collector of tiles, because NavMeshBuilder.CollectSources will not work
- Creates walkable mesh box from world bounds.
- Convert tiles to sources as NavMeshBuilder would do.