title: Addressing 'Transform child out of bounds' exception
body: <p>I'm going to set the child <code>GameObject</code>'s <code>SetActive</code> to true when the parent <code>GameObject</code> is triggered.</p>
  
  <p><a href="https://i.stack.imgur.com/CwhLc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CwhLc.png" alt="enter image description here"></a></p>
  
  <p>Like this picture, <code>BallIndigo1</code> is the parent <code>GameoOject</code> and <code>x</code> is the child <code>GameObject</code> which is in <code>SetActive(false)</code>.</p>
  
  <p>and I wrote code like this:</p>
  
  <pre><code>void OnTriggerEnter2D(Collider2D col)
  {
      if (col.gameObject.activeSelf == true)
      {
          if (col.transform.GetChild(0) != null)
          {
              col.transform.GetChild(0).gameObject.SetActive(true);
          }
          else
          {
              Debug.Log("No child");
          }
      }
  }
  </code></pre>
  
  <p>But the result says:</p>
  
  <p><a href="https://i.stack.imgur.com/QcKop.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QcKop.png" alt="enter image description here"></a></p>
  
  <p>I don't know why this happened and how to fix it.</p>