コード例 #1
0
            /// <summary>
            /// Remove the child element located at this position from this element's contentContainer
            /// </summary>
            public void RemoveAt(int index)
            {
                if (index < 0 || index >= childCount)
                {
                    throw new ArgumentOutOfRangeException("Index out of range: " + index);
                }

                var child = m_Owner.m_Children[index];

                child.InvokeHierarchyChanged(HierarchyChangeType.Remove);
                RemoveChildAtIndex(index);

                int imguiContainerCount = child.imguiContainerDescendantCount + (child.isIMGUIContainer ? 1 : 0);

                if (imguiContainerCount > 0)
                {
                    m_Owner.ChangeIMGUIContainerCount(-imguiContainerCount);
                }

                child.hierarchy.SetParent(null);

                if (childCount == 0)
                {
                    ReleaseChildList();

                    m_Owner.AssignMeasureFunction();
                }

                // Child is detached from the panel, notify using the panel directly.
                m_Owner.elementPanel?.OnVersionChanged(child, VersionChangeType.Hierarchy);
                m_Owner.IncrementVersion(VersionChangeType.Hierarchy);
            }