PATHFINDING in a grid game

I want make an easy pathfinding for turn based tactical game. I dont need any dynamic search or navmesh etc… I have a grid, I have a 2d-array (0 - empty cell, 1 - occupied
one). The path is to the center of each cell. Can anyone explain the algorithm? and some examples… And how can I render the path line? Thanks.

I’d recommend something like Primm’s or Dijkstra’s algorithm as it will find you the shortest path. You can find more info on path finding here: Pathfinding

For rendering lines in Unity you could use a LineRenderer or purchase Vectrosity, which will allow for Debug-style line drawing in the game. (And many other features.)

Lines can be drawn with something like this script:
http://wiki.unity3d.com/index.php?title=DrawLine

As for Grid-based pathfinding, you might save yourselfe a lot of work by just using Aron Granberg’s Astar Pathfinding Project, it comes with support for Grid Graphs.