// Update is called once per frame void Update() { if (iteration < waitforframes) { iteration++; } else if (iteration == waitforframes) { //We wait just the right number of iterations resetScrollBar(); iteration++; } else { //We are here after the first few frames if (eventSystem.firstSelected.GetType().ToString() == "SaltButter.UI.UIDropDownItem") { UIDropDownItem firstSelect = eventSystem.firstSelected as UIDropDownItem; int currentSelected = firstSelect.value; if (currentSelected != oldSelected) { oldSelected = currentSelected; if (bar) { bar.value = Mathf.Max(0, Mathf.FloorToInt((((float)firstSelect.value) / dropdown.options.Count) * bar.nbSteps - 0.2f)); bar.Refresh(); } } } } }
public void resetScrollBar() { if (eventSystem.firstSelected.GetType().ToString() == "UIDropDownItem") { UIDropDownItem firstSelect = eventSystem.firstSelected as UIDropDownItem; if (bar) { bar.value = Mathf.Max(0, Mathf.FloorToInt((((float)firstSelect.value) / dropdown.options.Count) * bar.nbSteps - 0.2f)); } } oldSelected = dropdown.value; if (bar) { bar.Refresh(); } }
public void resetScrollBar() { Debug.Log("We are Here"); if (eventSystem.firstSelected.GetType().ToString() == "SaltButter.UI.UIDropDownItem") { UIDropDownItem firstSelect = eventSystem.firstSelected as UIDropDownItem; Debug.Log("Found UIDropDownItem"); if (bar) { bar.value = Mathf.Max(0, Mathf.FloorToInt((((float)firstSelect.value) / dropdown.options.Count) * bar.nbSteps - 0.2f)); Debug.Log("Found Drop down item and have " + bar); } } else { Debug.Log(eventSystem.firstSelected.GetType().ToString()); } oldSelected = dropdown.value; if (bar) { bar.Refresh(); } }