bool InheritDependencies() { if (spectrumFilter) { return(true); } Transform parent = transform.parent; if (spectrumFilter == null) { spectrumFilter = GetComponent <SpectrumFilter>(); } while (spectrumFilter == null) { if (parent != null) { spectrumFilter = parent.GetComponent <SpectrumFilter>(); parent = parent.parent; } else { break; } } return(spectrumFilter); }
public override void OnInspectorGUI() { serializedObject.Update(); SpectrumFilter spectrumFilter = (SpectrumFilter)target; SpectrumGUILayout.SpectrumField(spectrumFilter, 2.0f, -1.0f); EditorGUILayout.PropertyField(spectrumSource, new GUIContent("SpectrumSource", "The SpectrumSource to filter. If this is set to None, then it'll try to find a SpectrumSource at runtime by looking up through the hierarchy.")); EditorGUILayout.PropertyField(eq, new GUIContent("EQ", "Allows the user to make finer adjustments to the spectrum.")); EditorGUILayout.PropertyField(interpolationType, new GUIContent("Interpolation", "Sets whether the values in between levels ease in and out or are straight lines.")); EditorGUILayout.PropertyField(scale, new GUIContent("Scale", "Scales all magnitudes equally for the given SpectrumSource")); EditorGUILayout.PropertyField(fallSpeed, new GUIContent("Fall Speed", "The time in seconds a level at maximum height will reach its minimum height.")); EditorGUILayout.PropertyField(beatSensitivity, new GUIContent("Beat Sensitivity", "The percentage threshold that a level has to move to trigger a beat. 1 equals 100%")); // Update frequently while it's playing. if (EditorApplication.isPlaying || GUI.changed) { Repaint(); } serializedObject.ApplyModifiedProperties(); }