void TreeView(Rect position) { if (Event.current.button == 0 && Event.current.type == EventType.MouseDown && position.Contains(Event.current.mousePosition)) { _simpleTreeView.SetSelection(new List <int>()); this.selectedSpriteIndex = -1; } _simpleTreeView.OnGUI(position); if (Event.current.button == 1 && Event.current.type == EventType.MouseUp && position.Contains(Event.current.mousePosition)) { IList <int> selections = _simpleTreeView.GetSelection(); int selectedId = -1; if (selections.Count != 0) { selectedId = _simpleTreeView.GetSelection() [0]; } TreeViewMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y - 10, 0, 0), selectedId); } }
private void OnSelectionChange() { selected = _simpleTreeView.SetSelection(Selection.gameObjects); _simpleTreeView.Reload(); }