title: Negative index (-1) at each click
body: <p>I have a little problem with my code:</p>
  
  <pre><code> public GameObject[] Letters;
   Randomizer WordsChildIndex;
   Transform[] LetterInteract;
   void Start () 
   {
      WordsChildIndex = new Randomizer(0, 29, true);
      int ChildIndex = WordsChildIndex.getRandom();
      Words.setCurrentChildIndex(ChildIndex);
      LetterInteract = Letters[ChildIndex].GetComponentsInChildren&lt;Transform();
      for(int i = 0; i &lt; LetterInteract.Length; i++)
      {
          LetterInteract[i].gameObject.AddComponent&lt;CircleCollider2D&gt;();
          LetterInteract[i].gameObject.GetOrAddComponent&lt;MouseEventSystem&gt;().MouseEvent += CheckLetterSound;
  
      }
  }   
  
  private void CheckLetterSound(GameObject target, MouseEventType type)
  {
      if(type == MouseEventType.CLICK)
      {
          int targetIndex = System.Array.IndexOf(LetterInteract, target);
          Debug.Log(targetIndex);
      }
  }
  </code></pre>
  
  <p>From the code, I notice that I add the Circle Collider component to random generated objects.</p>
  
  <p>The problem is that for every click the targetIndex is -1. For example, a click on the object with index 2, the targetIndex must be 2 and so on.</p>
  
  <p>Can anyone tell me where the error in my code is?</p>