void ShowOption() { if (currentOptionProperty.isExpanded) { EditorGUI.indentLevel += 1; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(currentOptionProperty.FindPropertyRelative("type")); if (EditorGUI.EndChangeCheck()) { containerManagerSerialized.ApplyModifiedProperties(); currentOption.SetDefaultValue(); } // Float fields if (currentOption.type == PureDataOption.OptionTypes.FadeIn || currentOption.type == PureDataOption.OptionTypes.FadeOut || currentOption.type == PureDataOption.OptionTypes.Volume || currentOption.type == PureDataOption.OptionTypes.MinDistance || currentOption.type == PureDataOption.OptionTypes.MaxDistance) { currentOption.SetValue(Mathf.Max(EditorGUILayout.FloatField("Value".ToGUIContent(), currentOption.GetValue <float>()), 0)); } else if (currentOption.type == PureDataOption.OptionTypes.Pitch) { currentOption.SetValue(EditorGUILayout.FloatField("Value".ToGUIContent(), currentOption.GetValue <float>())); } // Slider fields else if (currentOption.type == PureDataOption.OptionTypes.RandomVolume || currentOption.type == PureDataOption.OptionTypes.RandomPitch || currentOption.type == PureDataOption.OptionTypes.PanLevel || currentOption.type == PureDataOption.OptionTypes.Time) { currentOption.SetValue(EditorGUILayout.Slider("Value".ToGUIContent(), currentOption.GetValue <float>(), 0, 1)); } else if (currentOption.type == PureDataOption.OptionTypes.DopplerLevel) { currentOption.SetValue(EditorGUILayout.Slider("Value".ToGUIContent(), currentOption.GetValue <float>(), 0, 10)); } // Min max slider fields else if (currentOption.type == PureDataOption.OptionTypes.PlayRange) { Vector2 playRange = currentOption.GetValue <Vector2>(); EditorGUILayout.MinMaxSlider("Value".ToGUIContent(), ref playRange.x, ref playRange.y, 0, 1); playRange.x = float.IsNaN(playRange.x) ? 0 : Mathf.Clamp(playRange.x, 0, playRange.y); playRange.y = float.IsNaN(playRange.y) ? 1 : Mathf.Clamp(playRange.y, playRange.x, 1); currentOption.SetValue(playRange); } // Bool fields else if (currentOption.IsBool) { currentOption.SetValue(EditorGUILayout.Toggle("Value".ToGUIContent(), currentOption.GetValue <bool>())); } // Enum fields else if (currentOption.type == PureDataOption.OptionTypes.Output) { ShowOutput(); } else if (currentOption.IsVolumeRolloffMode) { currentOption.SetValue((PureDataVolumeRolloffModes)EditorGUILayout.EnumPopup("Value".ToGUIContent(), currentOption.GetValue <PureDataVolumeRolloffModes>())); } // Audio clip fields else if (currentOption.IsClip) { currentOption.SetValue((AudioClip)EditorGUILayout.ObjectField("Value".ToGUIContent(), currentOption.GetValue <AudioClip>(), typeof(AudioClip), true)); } EditorGUI.indentLevel -= 1; } }