private static TreeHierarchyNodeAsset CreateHierarchyNodeAsset(TreeHierarchyAsset hierarchy) { var hieNode = ScriptableObject.CreateInstance <TreeHierarchyNodeAsset>(); AssetDatabase.AddObjectToAsset(hieNode, hierarchy); return(hieNode); }
public static void AddAsFloatingNode(this TreeHierarchyAsset tree, TreeNodeAsset newNode) { Debug.Assert(newNode._hierarchy == null, nodeInHierarchyMsg); var hierarchyNode = CreateHierarchyNodeAndLink(tree, newNode); hierarchyNode._tree = tree; tree._floaters.Add(hierarchyNode); }
public static void SetupRoot(this TreeHierarchyAsset tree, TreeNodeAsset root) { Debug.Assert(tree._root == null); var rootHierarchyNode = CreateHierarchyNodeAndLink(tree, root); tree._root = rootHierarchyNode; rootHierarchyNode._tree = tree; }
private static TreeHierarchyNodeAsset CreateHierarchyNodeAndLink(this TreeHierarchyAsset tree, TreeNodeAsset node) { Debug.Assert(node._hierarchy == null, nodeInHierarchyMsg); var hieNode = CreateHierarchyNodeAsset(tree); hieNode.name = string.Format("_Node ({0})", node.name); node._hierarchy = hieNode; hieNode._content = node; return(hieNode); }