# Demo 03 - A\*

If you have the A\* Pathfinding Project installed in your project you can extract the Demo\_03\_AStarPathfinding package.\
This demo showcases the use of the GridGraph of the A\* Pathfinding Project Asset. The input is handled by the script **PathGridAStarPathfindingInput**.&#x20;

The PathGridAStarPathfindingInput requires a seeker component for finding a path.

## PathGridAStarPathfindingInput&#x20;

<div align="left"><figure><img src="https://3963147461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTlNb1QUHzJTiyPU8fXSC%2Fuploads%2FlacgJxt0PzNCQAlLMDTT%2FPathGridAStarInput.PNG?alt=media&#x26;token=fcc3c12f-d669-4f81-9bbd-ca34a5de374d" alt=""><figcaption></figcaption></figure></div>

What this script do:

1. When system is enabled, we wait for the users first click (clickCount).
2. On first click, we start creating a path from start position to current mouse grid position.
3. If path has been found, we instantiate preview tiles along the path.
4. When user clicks the second time, we clear the preview tiles and pass the vector path to the PathGridSystem.

## Pathfinder - Setup

When using the pathfinder, it makes sense to set the settings as follow:

<div align="left"><figure><img src="https://3963147461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTlNb1QUHzJTiyPU8fXSC%2Fuploads%2FJeKKwS2JSdwrGR2v8RRS%2FAStarGraphSettings.PNG?alt=media&#x26;token=e4d53168-084a-47d3-9d99-1dc960f83e3e" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://3963147461-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTlNb1QUHzJTiyPU8fXSC%2Fuploads%2FPM8vYRR1xyA0GRyFN13g%2FAStarGraphSettings_02.PNG?alt=media&#x26;token=2b1ffa08-2520-4681-b51a-0159bd655990" alt=""><figcaption></figcaption></figure></div>

* Connections: Four
* Heuristic: Manhattan
  * Heuristic Scale: 100 (could be lower, this is something you would need to test for your setup)
