title: Unity3D list made of scrollview and buttons - how to delete item?
body: <p>I have made list in Unity3D with ScrollView, Texts and Buttons.
  When user clicks button near the item - the item should be deleted.
  Buttons and Texts are created with Instantiate method.
  The list of items is generic list (List).</p>
  
  <p>List of items:</p>
  
  <pre><code>public List&lt;Item&gt; Items { get; set; }
  </code></pre>
  
  <p>Creating buttons and texts:</p>
  
  <pre><code>public Button itemButton;
  public Text itemText;
  (...)
  public void ShowItems()
  {
      ClearItems(); //Destroys button and text gameObjects.
  
      foreach (var item in Globals.Items)
      {
          var text = Instantiate(itemText) as Text;
          var button = Instantiate(itemButton) as Button;
          button.GetComponentInChildren&lt;Text&gt;().text = "Delete";
          textsList.Add(text); //save Text element to list to have possibility of destroying Text gameObjects
          buttonsList.Add(button);//save Button element to list to have possibility of destroying Button gameObjects
          text.gameObject.SetActive(true);
          button.gameObject.SetActive(true);
          //(...) Setting GUI items position here
      }
  }
  </code></pre>
  
  <p>How to detect which item's button is clicked to remove the item?</p>
  
  <p>I have no idea how to get that second button click == second item delete.</p>
  
  <p><a href="https://i.stack.imgur.com/Ue0ug.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ue0ug.png" alt="List made with ScrollView, Texts and Buttons"></a></p>