public void SetIndex(int index) { MulticoloredList componentInParent = GetComponentInParent <MulticoloredList>(); if (componentInParent != null) { Image component = GetComponent <Image>(); component.color = componentInParent.GetColorForIndex(index); } }
private void Start() { if (multicoloredList == null) { multicoloredList = GetComponentInParent <MulticoloredList>(); if (multicoloredList == null) { throw new MissingReferenceException("MulticoloredListElements must be a child of a MulticoloredList"); } } multicoloredList.Refresh(); }