private void DisplayWidget(int id) { // Remove any active Highlighting m_Bend.SetHighlight(null); m_HelpWidget.GetComponentInChildren <BendHelp>().UnSelect(); // Don't reselect the same Widget if (m_ActiveParameter == id) { return; } // Disable current Widget if (m_ActiveWidget != null) { m_ActiveWidget.gameObject.SetActive(false); } m_ActiveParameter = id; BendParameter param = m_Bend.inputParameters[id]; EBendParameterType type = param.type; object[] range = BendParameter.GetRange(param.name); switch (type) { case EBendParameterType.FloatAngle: m_ActiveWidget = m_AngleWidget; m_ActiveWidget.gameObject.SetActive(true); AngleSlider ans = m_AngleWidget.GetComponentInChildren <AngleSlider>(); ans.SetRange((float)range[0], (float)range[1]); ans.value = (float)param.value; break; case EBendParameterType.Float: m_ActiveWidget = m_RulerWidget; m_ActiveWidget.gameObject.SetActive(true); MultiRulerSlider mr = m_RulerWidget.GetComponentInChildren <MultiRulerSlider>(); mr.SetRange((float)range[1]); mr.Set((float)param.value, false); break; case EBendParameterType.Integer: m_ActiveWidget = m_IntegerWidget; m_ActiveWidget.gameObject.SetActive(true); IntegerSlider ins = m_IntegerWidget.GetComponentInChildren <IntegerSlider>(); ins.SetRange((int)range[0], (int)range[1]); ins.SetName(BendParameter.GetStringValue(param.name)); ins.value = (int)param.value; break; case EBendParameterType.StringEnum: m_ActiveWidget = m_EnumWidget; m_ActiveWidget.gameObject.SetActive(true); EnumDropdown ed = m_EnumWidget.GetComponentInChildren <EnumDropdown>(); List <Dropdown.OptionData> enumList = ed.options; StringEnum se = (StringEnum)param.valueObject; int enumStart = (int)range[0]; int enumEnd = (int)range[1]; enumList.Clear(); for (int i = enumStart; i <= enumEnd; ++i) { enumList.Add(new EnumDropdown.EnumOptionData(se.ToStringValue(i), null, se.ToDescription(i))); } ed.value = (int)param.value; ed.Refresh(); break; default: throw new ArgumentException("BendInputScreen: DisplayWidget() Invalid type."); } }