Ejemplo n.º 1
0
        // ReSharper disable ParameterHidesMember
        // ReSharper disable MemberCanBeMadeStatic.Local
        // ReSharper disable UnusedParameter.Local

        private void CreateIntSlider(int val, FieldInfo field, GameObject panel)
        {
            //If it's an int or a float, we need to check if it has a range attribute
            RangeAttribute rangeAttribute = field.GetFieldRange();

            if (rangeAttribute == null)
            {
                Logger.Error("{SettingField} doesn't have a Range attribute!", field.Name);
                return;
            }

            Slider slider = optionsPanel.AddSliderToPanel(panel, field.GetObjectDisplayText(), val, true, (int)rangeAttribute.min, (int)rangeAttribute.max);

            slider.onValueChanged.AddListener(f => field.SetValue(GetSettingObject(field), (int)f));
        }