public void Apply(Color newColor) { // Get the image component UISelectField select = this.gameObject.GetComponent <UISelectField>(); if (select == null) { return; } switch (this.m_ElementType) { case ElementType.List: select.listBackgroundColor = newColor; break; case ElementType.Separator: select.listSeparatorColor = newColor; break; } #if UNITY_EDITOR if (!Application.isPlaying) { EditorUtility.SetDirty(select); } #endif }
/// <summary> /// Initialize the option. /// </summary> /// <param name="select">Select.</param> /// <param name="text">Text.</param> public void Initialize(UISelectField select, Text text) { this.selectField = select; this.textComponent = text; this.m_HasInitialized = true; this.OnEnable(); }
protected void Awake() { this.m_Select = this.gameObject.GetComponent <UISelectField>(); }