void CreateEmoji() { int count = m_emjDataLst.Count; int min = Mathf.Min(count, m_emjImgLst.Count); for (int i = 0; i < min; i++) { m_emjImgLst[i].gameObject.SetActive(true); m_emjImgLst[i].SetEmojiName(m_emjDataLst[i].emj); } while (m_emjImgLst.Count < count) { GameObject obj = new GameObject("emoji"); obj.transform.SetParent(transform); obj.transform.localScale = Vector3.one; ImageEx img = obj.AddComponent <ImageEx>(); img.raycastTarget = false; img.rectTransform.anchorMin = Vector2.up; img.rectTransform.anchorMax = Vector2.up; img.rectTransform.pivot = Vector2.up * 0.16f; img.rectTransform.sizeDelta = Vector2.one * fontSize; img.SetEmojiName(m_emjDataLst[m_emjImgLst.Count].emj); m_emjImgLst.Add(img); obj.SetActive(true); obj.hideFlags = HideFlags.DontSaveInEditor; } }