So in my code I currently have this:
public GameObject enemyPrefab;
Vector3 position = new Vector3(81.5f, 1.859728f, 4.802853f);
// Use this for initialization
void Start()
{
InvokeRepeating("SpawnEnemy", 0.0f, 1f);
}
// Update is called once per frame
void Update ()
{
}
void SpawnEnemy()
{
Instantiate(enemyPrefab, position, Quaternion.identity);
}
What I need is for InvokeRepeating to only run a certain number of times. For example, having an integer that represents the amount of times I need it to run.
↧