private void OnSelectionChanged(object sender, SelectionChangedArgs e) { SelectedItems = e.NewItems.Select(o => ((GameObject)o).GetComponent <CUIObject>()).Where(p => p != null).ToList(); SelectedItem = SelectedItems.Count > 0 ? SelectedItems.Last() : default(CUIObject); if (e.NewItems == null || e.NewItems.Length == 0) { HideAllPanels(); } else { ShowAllPanels(); } if (SelectedItem != null) { m_NameField.SetValue(SelectedItem.Name); m_FadeOutField.SetValue(SelectedItem.FadeOut); } foreach (var component in m_Components) { component.OnItemsSelected(SelectedItems); } }
protected virtual void Awake() { cuiObject = GetComponent <CUIObject>(); }