Visual pathfinding

Hey guys I want to make a pathfinding line from my player object to another object. So when my player moves away from the object it can always follow the pathfinding line to go back to the object. I look at many tutorial and I did not find any help. Please link any tutorials or ways to do this thank.

Generally the official documentation is a good way to start.

Here is a link that explains how to make a NavMeshAgent move to a destination. But if it’s your first time using the navigation package I recommend that you look at the overview first.

1 Like

Use NavMesh.CalculatePath() to generate the path, then use a LineRenderer where the points of the LR are the corners of the Path. The docs I linked to have a good example just using Debug.DrawLine instead of a LineRenderer, but otherwise it’s exactly what you’re looking for.

1 Like