public static ElementContainer Create(ElementPanel _Panel, int _Axis) { GameObject containerObject = new GameObject("container"); ElementContainer container = containerObject.AddComponent <ElementContainer>(); container.Setup(_Panel, _Axis); return(container); }
void CollectContainers() { for (int i = m_Containers.Count - 1; i >= 0; i--) { ElementContainer container = m_Containers[i]; if (container == null || container.transform.parent != transform || container.IsDestroying() || container.IsDestroyed()) { m_Containers.RemoveAt(i); } } HashSet <ElementContainer> containers = new HashSet <ElementContainer>(m_Containers); int axis; switch (m_Direction) { case Direction.Horizontal: axis = 0; break; case Direction.Vertical: axis = 1; break; default: return; } for (int i = 0; i < transform.childCount; i++) { ElementContainer container = transform.GetChild(i).GetComponent <ElementContainer>();; if (container == null || container.IsDestroying() || container.IsDestroyed()) { continue; } container.Setup(this, axis); if (containers.Contains(container)) { continue; } m_Containers.Add(container); } }