public GameObject spawnObj;
public Vector3 spawnPos;
void Start()
{
StartCoroutine("spawn");
}
IEnumerator spawn()
{
for (int i = 0; i < 2; i++)
{
spawnPos.x = Random.Range(-4.3f, 4.4f);
spawnPos.y = Random.Range(-2.75f, 2.8f);
int wait = Random.Range(0, 1);
yield return new WaitForSeconds(wait);
Instantiate(spawnObj, spawnPos, Quaternion.identity);
}
}
}