public void OnGUI() { if (Event.current.type == EventType.MouseDown && position.Contains(Event.current.mousePosition) && Event.current.button == 0) { Selection.activeGameObject = assetObject; } isShow = EditorGUI.Foldout(position, isShow, title, UIAssistantTools.GetStyles(nodeInfo.BatchID % UIAssistantTools.DefaultDepth)); if (subTitle != null) { EditorGUI.LabelField(new Rect(position.x + position.width + 5, position.y, position.width, position.height), subTitle, subTitleGuiStyle); } if (isShow) { float childY = position.y + position.height; for (int i = 0; i < children.Count; i++) { if (children[i] != null) { children[i].position.y = childY; children[i].OnGUI(); childY = childY + children[i].recursiveSize.y; } } } CalcRecursiveSize(); }
private void Refresh() { if (m_treeRootNode != null) { m_treeRootNode.Destroy(); } if (m_selectObj != null) { depthIdx = 1; m_treeRootNode = new TreeNode(m_selectObj.name, m_selectObj, depthIdx * defaultDepth); m_treeRootNode.IsRoot = true; GenChildNodes(m_treeRootNode, m_selectObj.transform); UIAssistantTools.GenTreeInfo(m_treeRootNode); } }