// *********************************************************************** // Assembly : Unity // Author : // Created : 2018-09-03 // // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class KUIGray : MonoBehaviour { private readonly static List _Graphics = new List(); private bool _gray; // Use this for initialization public void SetGray(bool gray) { if (gray != _gray) { _gray = gray; _Graphics.Clear(); GetComponentsInChildren(_Graphics); foreach (var graphic in _Graphics) { graphic.material = gray ? Resources.Load("Materials/UIGray") : null; } } } }