public void SelectGesture(bool pos) { if (pos) { index++; } else { index--; } if (index < 0) { index = gestures.Count - 1; } if (index > gestures.Count - 1) { index = 0; } IconBase i = gestures[index].i_base; gestureSelector.transform.SetParent(i.transform); gestureSelector.anchoredPosition = new Vector2(46, -50); }
void CreateGesturesUI() { for (int i = 0; i < gestures.Count; i++) { GameObject go = Instantiate(gestureIconTemplate) as GameObject; go.transform.SetParent(gesturesGrid.transform); go.transform.localScale = Vector3.one; go.SetActive(true); IconBase icon = go.GetComponentInChildren <IconBase>(); icon.icon.sprite = gestures[i].icon; icon.id = gestures[i].targetAnim; gestures[i].i_base = icon; } gesturesGrid.SetActive(false); gestureSelector.gameObject.SetActive(false); index = 1; SelectGesture(false); }