What is the best technique to create a "grid"?

I am new to unity and i was wondering what is the best strategy to create something like this:

If anyone knows some forum or video about it, or just some hint for me to study, i would appreciate. Thanks.

Depends if you want this to be done with Sprites or as UI Elements. If it’s UI Elements, there actually is a Grid Layout Group.
If these are supposed to be ‘normal’ GameObjects, again it depends on what you want to do. You’re asking a very generic question, but the specific implementation depends entirely on your goal. Do they have fixed positions? Do they move? Do they wrap around the edge? Are new ones added at runtime? Can they be deleted at runtime? I could go on and on. This is not a problem with a generic solution. I mean, maybe this code would already be enough, I don’t know what exactly you’re trying to do:

[SerializeField] GameObject elementPrefab;
Vector2 topLeftPos = Vector2.zero;
int rows = 2;
int columns = 9;
float spacing = 1f;


for (int i=0; i < rows; i++)
{
     for (int j=0; j < columns; j++)
     {
          Instantiate(elementPrefab,
                      topLeftPos + new Vector2(j*spacing, i*spacing),
                      Quaternion.identity);
     }
}

This would just instantiate prefabs in a grid with a spacing of 1

Amen to this. The example Zephus posted is perfect for GameObjects in the normal world space.

If you’re talking UI, just use the GridLayoutGroup Component and let it handle things for you.

Attached is an example of doing that with a dynamic number of UI elements.

8494565–1130474–DynamicUIDemo.unitypackage (55.7 KB)