Transform[] syntax error

Type UnityEngine.Transform[]' does not contain a definition for Add’ and no extension method Add' of type UnityEngine.Transform’ could be found (are you missing a using directive or an assembly reference?)

I’m getting error when I try to add spawn to array

using UnityEngine;
using System.Collections;
 
public class SpawnController : MonoBehaviour 
{
    
    private Transform[] spawnsList;
     
    
    private int numberOfSpawns;
     
    
    public GameObject prefab;
     
 
    public int noPrefabsToSpawn;
     
     
  
    void Awake () 
    {
       
        numberOfSpawns = transform.childCount;
         
        
        spawnsList = new Transform[numberOfSpawns];
         
        
        GameObject container = GameObject.Find("SpawnContainer");
         
       
        foreach (Transform spawn in container.transform)
        {
            // add the spawn to the array
            spawnsList.Add(spawn);
        }
    }
}

As the compiler says: C# arrays do not have a function named Add.

If you want to use a static array:

spawnsList = new Transform[numberOfSpawns];
int counter = 0;
foreach (Transform spawn in container.transform) {
    spawnsList[i++] = spawn;
}

If you want a dynamically sized collection, you might instead use a List:

spawnsList = new List<Transform>();
foreach (Transform spawn in container.transform) {
    spawnsList.Add(spawn);
}

See the Unity wiki: Which Kind Of Array Or Collection Should I Use?

In particular, their section on the List class.

Arrays have no Add method, you’ll have to either manually allocate the number of elements when instantiating (like you do on line 26) and set the values by index (spawnsList[x] = value; making sure the index x doesn’t go out of bounds), or simply use a List which does have an Add method defined and will dynamically grow in size (not requiring you to set it’s capacity beforehand). I’d recommend the latter in your case, although I’m not entirely clear on what you are trying to accomplish.