void Init() { if (listItem == null) { indexSel = -1; listItem = new List <UIDot>(); GameObject obj = PrefabCache.main.Load(UIDot.PREFAB_UIDOT); uiDotPrefab = obj.GetComponent <UIDot>(); } }
void AddItem() { float w, h; UIDot uiDot = (UIDot)GameObject.Instantiate(uiDotPrefab); uiDot.transform.parent = this.transform; uiDot.transform.localScale = new Vector3(1f, 1f, 1f); uiDot.index = listItem.Count; w = h = GetComponent <RectTransform>().rect.height; uiDot.GetComponent <RectTransform>().sizeDelta = new Vector2(w, h); uiDot.UpdateItem(false); listItem.Add(uiDot); }