Instantiate gameobject and add to array (C#)

Hi fellow Uniters, i’ve run into a little problem here. Any help would be greatly appreciated. I’m trying to instantiate an enemy combatant and have it fill in the enemyCount array. Here’s my code so far:

using UnityEngine;
using System.Collections;

public class Enemy : MonoBehaviour
{
  public GameObject enemyCombatant;
  public int[] enemyCount;
  public int maxEnemies = 5;

  void Start ()
  {
    enemyCount = new int[maxEnemies];
  }

  void FixedUpdate ()
  {
    for (int numberOfEnemies = 0; numberOfEnemies <= maxEnemies; numberOfEnemies++)
    {
      GameObject enemyCombatantClone = Instantiate(enemyCombatant, new Vector3(40, 2, 0), Quaternion.identity) as GameObject;
    }
   }
}

In the loop should be

enemyCount *= Instantiate (enemyCombatant, new Vector3(40, 2, 0), Quaternion.identity) as GameObject;*

Just use the standard “i” for the loop index name; “numberOfEnemies” is not a good name since you’re not actually increasing the number of enemies. The loop should be “i < maxEnemies”, not <=, since that will be out of range. Also the loop should not be in FixedUpdate, which is used for physics, and runs every physics frame. I’d recommend using a different name for the array than “enemyCount”, which doesn’t describe the contents. Something like “enemyCombatants” would be better.