Here’s my code:
public Transform[] SpawnPoints;
public float spawnTime = 1.5f;
public GameObject[] coins;
public float nocount;
void SpawnCoins()
{
nocount += 1;
if (nocount = 3)
int spawnIndex = Random.Range (0, SpawnPoints.Length);
int objectIndex = Random.Range (0, coins.Length);
Instantiate (coins[objectIndex], SpawnPoints [spawnIndex].position, SpawnPoints [spawnIndex].rotation);
}
void Start()
{
InvokeRepeating ("SpawnCoins", spawnTime, spawnTime);
nocount = 0;
}
I would like to know how to make it so that when the nocount variable is 3, the method (I hope I used this word correctly) does NOT proceed with executing the instantiate code.