title: Unity 3d Access specific Text Element among multiple children
body: <p>I'm writing UI for a game and Im stuck at a point where I need to access specific text and assign a value for each of it.
  Case: Different teams have different number of players and each player has different stats(like strength etc). I have 'n' game objects( n varies depending on the condition). Hence, directly public refering to game obejcts manually is not possible. A Panel has 3 child panels. each child panel has atleast 3 text elements. Each element needs to have a different value. </p>
  
  <p>I have an array of gameobjects. Each gameobject in the array has different text elements. So what im trying is:</p>
  
  <pre><code> cards[1].playerName.text="A" , (or cards[1].playerName.text=anotherArray[1] )
   cards[1].Strength.text="90";
   cards[2].playerName.text="B" , 
   cards[2].Strength.text="40"
  </code></pre>
  
  <p>and I want to retrieve them :</p>
  
  <pre><code> if(MyTeam=="Team1")
          {
               int i = 0;
               while(i&lt;25 &amp;&amp; Cards[i]!=null)
               {
                   Cards[i].gameObject.GetComponentInChildren().text = Team1Roster[i].ToString();
                   Debug.Log(Cards[i].GetComponentInChildren());
                   i++;
               }
          }
  </code></pre>
  
  <p>In the above method, the topmost Text element is getting selected.
  How do I select different text elements from each object.</p>
  
  <p>I have also tried this way:</p>
  
  <pre><code>while(i&lt;25 &amp;&amp; Cards[i]!=null)
          {
              Cards[i].gameObject.GetComponentInChildren&lt;Text&gt;().text = Team1Roster[i].ToString();
              var li=Cards[i].GetComponentsInChildren&lt;Text&gt;();
              foreach (Text text in li)
              {
                  li.text = "";
              }
              i++;
  
          }
  </code></pre>