Hey guys,
I’m trying to get a certain gameobject to spawn at specific spawn points (which I’ve allocated with empty gameobjects) which is all working dandy but now I want the object to spawn at random times which then spawn faster over time (increases in amount spawned every minute or so). They do not need to move or anything, just spawn in the one location.
I’m pretty new to coding and I’ve attached what I’ve got so far. Any help would be greatly appreciated!
- using System.Collections;
-
- public class Spawn : MonoBehaviour {
- public Transform spawnPoint;
- public Transform spawnObject;
- public int spawnTotal;
- public float timeBetweenSpawns;
-
- // Use this for initialization
- void Start () {
- StartCoroutine (SpawnGameObject ());
- }
-
- // Update is called once per frame
- void Update () {
-
- }
- IEnumerator SpawnGameObject(){
- for ( var x = 0 ; x < spawnTotal; x++) {
- Instantiate (spawnObject, spawnPoint.position, spawnPoint.rotation);
- yield return new WaitForSeconds (timeBetweenSpawns);
-
- }
-
-
- }
-
- }