# What is the best way to create a square grid in Unity?

So I need to create a square grid like the one below. And be able to click on a square, the square you chose then is filled with a different color as well as all the squares right and below the square you have chose. My question is what will be the most efficient way to create this grid either in 3D or 2D in Unity.

• What have you tried? May 6 '20 at 9:48
• I tired doing it with 2d sprites but found a problem when wanting to press and delete multiple sprites. Also tried using squares in a 3d space with a 2d view but keeping track of the different positions of each block and what need to be deleted after a square has been selected just confused me. Now I'm trying to do it with buttons? May 6 '20 at 9:55

• When scripting, the Tilemap component allows you to access individual tiles with tilemap.GetTile and even has a convenient method for setting the color tint of a tile directly with tilemap.SetColor