private void Start()
        {
            var renders = GetComponentsInChildren <Renderer>();

            if (renders.Length > 0)
            {
                var randColor = ColorsUtils.GetRandomColor();
                renders.ToList().ForEach(r => { r.material.color = randColor; });
            }
        }
Example #2
0
        public void SetChildrenColor(int index)
        {
            if (_target == null)
            {
                Debug.LogWarning($"{this.gameObject} without a target image");
                return;
            }

            var images = _target.GetComponentsInChildren <Image>();
            var color  = ColorsUtils.ConvertIntToColor((uint)index);

            for (int i = 0; i < images.Length; i++)
            {
                SetColorFromColorsField(images[i], index);
            }
        }