I am making a game in Unity2D i which you have to match the correct projectiles with the enemies but I can't randomly spawn them, it just spawns one... (btw this is my first game)
{ timeBTWSpawn = StartTimeBTWSpawn; private void Update() { if(timeBTWSpawn <= 0 ) { rand = Random.Range(0, enemies.Length); Instantiate(enemies[0], SpawnPoint.transform.position, Quaternion.identity);``` timeBTWSpawn = StartTimeBTWSpawn; } else { timeBTWSpawn -= Time.deltaTime; } } } i expect 3 different enemies to be randomly spawned but it only spawns the first one in the array.
enemies[0]withenemies[rand]because currently you are instantiating only the first enemy in the array, but if it was[rand]then you will be instantiating the enemy at the position returned by theRandom.Rangemethod