Showing AI Navigation Path In Unity
I was playing my stealth top-down click-to-move game, and decided to add a subtle indication of the path the player character would walk.
Today’s Objective: Use a Line Renderer to subtly show the path that the player character will walk when moving, making navigation feel a little safer.
The Setup:
Since the actual movement code has already been completed in a previous post (Point-And-Click Movement), this one will not contain too much.
First I create a GameObject in the scene which is simply a 3D plane. I find a nice texture to be the icon, and create an Unlit Transparent material for it.
After disabling that GameObject (since it should only be active when the player is moving), I add a Line Renderer component to the Player object and set the line width to 0.1, material to “Default-Line”, and color to grey.
Now for the code:
The Result:
I think it looks great, and gives just enough indication to not be too over-the-top.