Instantiate in an area

i want to intantiate a gameobject in a 10x10 area with 1 game object every unit (X=0; Y=0 , X=1; Y=0 , Ecc…),
i want to do it in a script without using hundreads of lines of code

Something like this? Just an example.

Place this script in your scene and link a prefab.


using UnityEngine;

public class Grid : MonoBehaviour
{
    [SerializeField] GameObject prefab;
    int xCount = 10;
    int yCount = 10;
    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < xCount; i++)
        {
            for (int k = 0; k < yCount; k++)
            {
                Instantiate(prefab, new Vector3(i, k, 0f), Quaternion.identity);
            }
        }
    }
}