private void DrawUpdateIntervalSlider(bool editor) { GUILayout.BeginHorizontal(); GUILayout.Label("Update interval: "); GUILayout.BeginVertical(); if (!editor) { GUILayout.Space(10f); } childrenUpdateInterval = GUILayout.HorizontalSlider(childrenUpdateInterval, 0.01f, 1f, UpdateIntervalSliderLayout); GUILayout.EndVertical(); GUILayout.Label(childrenUpdateInterval.ToString()); GUILayout.FlexibleSpace(); var labels = DisplayOptionUtils.Names; var oldDisplayOptions = displayOptions; for (int i = 0; i < labels.Length; i++) { bool enabled = displayOptions.IsSet(i); enabled = GUILayout.Toggle(enabled, labels[i]); displayOptions = displayOptions.With(i, enabled); } ClearFieldInfoCacheIfNecessary(oldDisplayOptions); GUILayout.EndHorizontal(); }
public static DisplayOption With(this DisplayOption flags, int optionIndex, bool enabled) { return(flags.With(GetByIndex(optionIndex), enabled)); }