//
        private void UpdateDropdown()
        {
            if (hr == null)
            {
                dropdownState.items.Clear();
                dropdownState.selected = -1;
                return;
            }

            // Update items
            var presets = hr.presets;
            int l       = presets.Count;

            dropdownState.items.Clear();
            for (int i = 0; i < l; i++)
            {
                HighlightingPreset preset = presets[i];
                GUIContent         item   = new GUIContent(preset.name);
                dropdownState.items.Add(item);
            }

            // Find and select currently active preset
            for (int i = 0; i < l; i++)
            {
                HighlightingPreset preset = presets[i];
                if (hr.downsampleFactor == preset.downsampleFactor &&
                    hr.iterations == preset.iterations &&
                    hr.blurMinSpread == preset.blurMinSpread &&
                    hr.blurSpread == preset.blurSpread &&
                    hr.blurIntensity == preset.blurIntensity &&
                    hr.blurDirections == preset.blurDirections)
                {
                    dropdownState.selected = i;
                    break;
                }
            }
        }
Esempio n. 2
0
        //
        IEnumerator Start()
        {
            highlightingRenderer.ClearPresets();
            for (int i = 0; i < customPresets.Count; i++)
            {
                highlightingRenderer.AddPreset(customPresets[i], false);
            }

            int index = 0;

            while (true)
            {
                ReadOnlyCollection <HighlightingPreset> presets = highlightingRenderer.presets;
                if (index >= presets.Count)
                {
                    index = 0;
                }
                HighlightingPreset preset = presets[index];
                highlightingRenderer.LoadPreset(preset.name);
                index++;

                yield return(new WaitForSeconds(interval));
            }
        }