How to find path in a boolean 2D array?


Is there any easy way to find path in a 2D array that is composed of boolean values, 1 for filled and 0 for empty?

My maps are consisted of such array and I need to be able to find paths in it for various reasons.

I’m aware of NavMesh but since maps or generated at runtime, I cannot do calculations offline.

If possible, please suggest any pathfinding asset that might help.


This uses a flood-fill algorithm for pathfinding. (The project is quite old, but works in Unity 4 aside from the “destroyed object stops coroutines running even on a different object” problem, though that can be fixed pretty easily.)