public void E_FillElements() { if (textsToHideShow == null) { textsToHideShow = new List <TMPro.TextMeshProUGUI>(); } textsToHideShow.Clear(); if (imagesToHideShow == null) { imagesToHideShow = new List <Image>(); } imagesToHideShow.Clear(); foreach (RectTransform RT in parentsToSearch) { TMPro.TextMeshProUGUI [] texts = RT.GetComponentsInChildren <TMPro.TextMeshProUGUI>(true); foreach (var item in texts) { textsToHideShow.Add(item); } Image [] image = RT.GetComponentsInChildren <Image>(true); foreach (var item in image) { imagesToHideShow.Add(item); } } }