void SerializeNodeData(BehaviorTreeNode node) { //Debug.Log("Serializing: " + node.ToString()); if (node.Children == null) { node.Children = new List <BehaviorTreeNode>(); } var serializedNodeData = new SerializableNodeData() { TypeAsString = node.GetType().ToString(), Name = node.Name, ID = node.ID, Depth = node.Depth, ChildCount = node.Children.Count }; SerializedNodeList.Add(serializedNodeData); for (int i = 0; i < node.Children.Count; ++i) { SerializeNodeData(node.Children[i]); } }
void CellGUI(Rect cellRect, TreeViewItem <BehaviorTreeNode> item, ViewColumns column, ref RowGUIArgs args) { CenterRectUsingSingleLineHeight(ref cellRect); BehaviorTreeNode node = item.data; switch (column) { case ViewColumns.kIcon: { GUI.DrawTexture(cellRect, (Texture2D)EditorGUIUtility.Load(node.GetIconPath()), ScaleMode.ScaleToFit); } break; case ViewColumns.kName: { Rect toggleRect = cellRect; toggleRect.x += GetContentIndent(item); toggleRect.width = TOGGLE_WIDTH; if (toggleRect.xMax < cellRect.xMax) { item.data.DEBUG_on = EditorGUI.Toggle(toggleRect, item.data.DEBUG_on); } args.rowRect = cellRect; args.label = item.data.Name; base.RowGUI(args); } break; case ViewColumns.kType: { cellRect.x += GetContentIndent(item); DefaultGUI.Label(cellRect, node.GetType().ToString().Split('.')[1], args.selected, args.focused); } break; } }