Example #1
0
        /// <summary>
        /// The serialized property for color temperature is stored in the build-in light editor, and we need to use this object to apply the update.
        /// </summary>
        /// <param name="value">The value to update</param>
        /// <param name="preset">The preset range</param>
        protected override void SetValueToPreset(SerializedProperty value, LightUnitSliderUIRange preset)
        {
            m_Settings.Update();

            base.SetValueToPreset(value, preset);

            m_Settings.ApplyModifiedProperties();
        }
Example #2
0
        /// <summary>
        /// The serialized property for color temperature is stored in the build-in light editor, and we need to use this object to apply the update.
        /// </summary>
        /// <param name="value">The value to update</param>
        /// <param name="preset">The preset range</param>
        protected virtual void SetValueToPreset(SerializedProperty value, LightUnitSliderUIRange preset)
        {
            m_SerializedObject?.Update();

            // Set the value to the average of the preset range.
            value.floatValue = preset.presetValue;

            m_SerializedObject?.ApplyModifiedProperties();
        }
Example #3
0
        LightUnitSliderUIRange CurrentRange(float value)
        {
            foreach (var l in m_Descriptor.valueRanges)
            {
                if (value >= l.value.x && value <= l.value.y)
                {
                    return(l);
                }
            }

            var cautionValue   = value < m_Descriptor.sliderRange.x ? m_Descriptor.sliderRange.x : m_Descriptor.sliderRange.y;
            var cautionTooltip = value < m_Descriptor.sliderRange.x ? m_Descriptor.belowRangeTooltip : m_Descriptor.aboveRangeTooltip;

            return(LightUnitSliderUIRange.CautionRange(cautionTooltip, cautionValue));
        }