Trying to spawn GameObjects at certain locations. (Unity2D),Trying to get GameObjects to spawn at specific locations (Unity2D).

Hi everyone, I am trying to get GameObjects to spawn at certain locations that I have named SpawnPoint ( they also have a spawn point tag attached to them as well) that is attached to a gameobject named SpawnController but i’m not sure how to do this I currently have some code for invoking a repeating function that spawns the gameobject but I don’t know how to change where it spawns to the Spawnpoints as it asks for a transform. Do I need to add the gameobjects to a list or an array? How would I go about doing that I’m pretty rubbish at using lists and arrays as i have no idea how to add objects to them.

Here is my code at the moment:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerUnitSpawn : MonoBehaviour
{

List<GameObject> selection;
public GameObject playerUnit;

// Use this for initialization
void Start()
{
    InvokeRepeating("SpawnUnit", 1f, 5f);
}

// Update is called once per frame
void Update()
{

}

void SpawnUnit()
{
        Instantiate(playerUnit, transform.position, transform.rotation);
    }
}

Any help is greatly appreciated. Thanks.

You can use my spawner code and learn from it:
https://github.com/AmirSavand/breaker/blob/master/Assets/Scripts/Spawner.cs

Test it:

Add this script to an object, then add points as children, it will spawn randomly there.

You don’t have to use this code exactly, you can modify or remove parts you don’t need.