How to draw a filled rectangle through script

Im trying to make a A* pathfinder for a maze. Im doing this with nodes(each square in the maze is a node). Now for debugging reasons I want to give certain notes different colors.

I want to do something like.

forloop...
{
openset*.drawrectangle(vector2 position);*

}
Ill appreciate any help.

Have a look at the OnDrawGizmos callback as well as the Gizmos class. If you’re working in the X-y plane you could use Gizmos.DrawGUITexture. If you work on different axes it’s probably simpler to just use Gizmos.DrawCube.