public void DestroyDrawChild() { int childCount = rectTransform.childCount; var components = ListPool <Component> .Get(); Draw d; for (int i = 0; i < childCount; ++i) { if ((d = (rectTransform.GetChild(i)).GetComponent <Draw>()) != null) { components.Add(d as Component); } } for (int i = 0; i < components.Count; ++i) { Tools.Destroy(components[i].gameObject); } ListPool <Component> .Release(components); }
public void DestroySelf() { Tools.Destroy(gameObject); }