Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. void Start () {
  2.  
  3. for(int i = 0; i < 5; i++)
  4. {
  5. GameObject goButton = (GameObject)Instantiate(prefabButton);
  6. goButton.transform.SetParent(ParentPanel, false);
  7. goButton.transform.localScale = new Vector3(1, 1, 1);
  8.  
  9. Button tempButton = goButton.GetComponent<Button>();
  10. int tempInt = i;
  11.  
  12. tempButton.onClick.AddListener(() => ButtonClicked(tempInt));
  13. }
  14.  
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement