Check out example codes for "spawner unity 2d". It will help you in understanding the concepts better.
Code Example 1
using UnityEngine;
public class Spawner : MonoBehaviour
{
public GameObject Object;
float timebtwspawn;
public float startTimeBtwSpawn;
void Update()
{
if (timebtwspawn <= 0)
{
Instantiate(Object, transform.position, Quaternion.identity);
}
else
{
timebtwspawn -= Time.deltaTime;
}
}
}
Learn ReactJs, React Native from akashmittal.com