Guest User

Untitled

a guest
Sep 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class UPStand : MonoBehaviour
  6. {
  7.  
  8. public GameObject SaleButtonPrefab;
  9. public GameObject ParentButton;
  10. public int
  11.  
  12. void Start()
  13. {
  14. //To loop all the list
  15. for(int i = 0; i < 3; i++)
  16. {
  17. //Instantiate the button prefab and make a parent
  18. GameObject nu = Instantiate(SaleButtonPrefab) as GameObject;
  19. nu.transform.SetParent(ParentButton.transform, false);
  20.  
  21. //To set the position and function
  22. nu.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (i*-289.5f) );
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment