title: Can only spawn one object at once in unity
body: <p>In my game I have a game object called <code>ExclamationMark</code> which I want to spawn above enemies heads when the player gets into range and they become "Alerted".</p>
  
  <p>I've made this simple script to do that, but for some reason it will only work on one game object.</p>
  
  <p>My enemy script:</p>
  
  <pre><code>void CheckForPlayer()
  {
      // Define player and get position
      var player = GameObject.FindWithTag("Player");
      var playerPos = (int)player.transform.position.x;
  
      if (transform.Find("Graphics"))
      {
          // Define gameobject position
          var enemyPos = transform.Find("Graphics").gameObject.transform.position.x;
  
          // Define range to spawn tiles in
          var range = 5;
          var rangeInfront = enemyPos + range;
          var rangeBehind = enemyPos - range;
  
          if (playerPos &gt;= rangeBehind &amp;&amp; playerPos &lt;= rangeInfront)
          {
              enemyIsActive = true;
  
              if (transform.Find("ExclamationMark"))
              {
                  var exMark = transform.Find("ExclamationMark").gameObject.GetComponent&lt;ExclamationMarkSpawn&gt;();
  
                  exMark.SpawnExclamationMark();
              }
          }
          else
          {
              enemyIsActive = false;
          }
      }
  }
  </code></pre>
  
  <p>My <code>!</code> script:</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class ExclamationMarkSpawn : MonoBehaviour {
  
      public GameObject spawnPos;
      public GameObject exclamationMark;
      public GameObject exclamationMarkAudio;
  
      public void SpawnExclamationMark()
      {
          StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent&lt;CameraShake&gt;().Shake(0.2f, 0.2f, 0.2f));
          Instantiate(exclamationMark, spawnPos.transform.position, Quaternion.identity);
          if (exclamationMarkAudio)
              Instantiate(exclamationMarkAudio, spawnPos.transform.position, Quaternion.identity);
          StartCoroutine(DestroyExclamationMark());
      }
  
      IEnumerator DestroyExclamationMark()
      {
          yield return new WaitForSeconds(1);
          var children = new List&lt;GameObject&gt;();
          foreach (Transform child in transform) children.Add(child.gameObject);
          children.ForEach(child =&gt; Destroy(child));
      }
  }
  </code></pre>