private void OnObjectMarkAsDestroyedChanged(ExposeToEditor o) { if (o.MarkAsDestroyed) { GameObject parent = null; bool isLastChild = false; if (o.Parent != null) { parent = o.Parent.gameObject; isLastChild = (o.Parent.ChildCount - o.Parent.MarkedAsDestroyedChildCount) <= 0; } m_treeView.RemoveChild(parent, o.gameObject, isLastChild); } else { GameObject parent = null; if (o.Parent != null) { parent = o.Parent.gameObject; } ExposeToEditor nextSibling = o.NextSibling(); m_treeView.AddChild(parent, o.gameObject); //TODO: replace with Insert if (nextSibling != null) { m_treeView.SetPrevSibling(nextSibling.gameObject, o.gameObject); } } }
protected virtual void SetSiblingIndex(ExposeToEditor o) { if (o.transform.parent == null && m_rootGameObjects == null) { m_rootGameObjects = SceneManager.GetActiveScene().GetRootGameObjects().OrderBy(g => g.transform.GetSiblingIndex()).ToList(); } ExposeToEditor nextSibling = o.NextSibling(m_rootGameObjects); if (nextSibling != null) { m_treeView.SetPrevSibling(nextSibling, o); } }