public void OnEnable() { //Bindings on the UI elements will target the attached BeatMachine.cs script _beatMachine = (BeatMachine)target; _beatMachine.m_metronome = _beatMachine.transform.GetComponent <Metronome>(); //Initialize the UI Elements _RootElement = new VisualElement(); _ControlElement = new VisualElement(); _PatternSetElement = new VisualElement(); _RootElement.name = "RootElement"; _ControlElement.name = "ControlsAndButtons"; _PatternSetElement.name = "PatternSets"; //Load the templates _BeatMachineTemplate = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/Metronome/Scripts/Editor/BeatMachineTemplate.uxml"); _BeatPatternTemplate = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/Metronome/Scripts/Editor/patternTemplate.uxml"); _ControlTemplate = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/Metronome/Scripts/Editor/ControlAreaTemplate.uxml"); //Load the styles StyleSheet stylesheet = AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/Metronome/Scripts/Editor/BeatMachineTemplate.uss"); _RootElement.styleSheets.Add(stylesheet); _beatMachine.ClearAllNotesFromScene(); _beatMachine.UpdateMenus(); }
public virtual void Awake() { m_vfx = this.GetComponentInChildren <ParticleSystem>(); m_light = this.GetComponentInChildren <Light>(); m_pattern = new List <bool>(); m_beatMachine = FindObjectOfType <BeatMachine>(); m_metronome = FindObjectOfType <Metronome>(); }
private void Awake() { m_beatMachine = FindObjectOfType <BeatMachine>(); }