- Home /
How to build an editor window with a treeview widget?
Hi,
I would like to build an editor window with a treeview very much like the project view or Hierarchy view. Only that the content is arbitrary, it's not the gameObject in the scene nor the project content.
Is it possible? Can't find anything in the help on this.
Thanks for your help,
Jean
One thing I need to improve in my own solution is handle an unlimited number of items in the tree view and have the control handle paging without impacting performance.
Answer by Bunny83 · Apr 12, 2011 at 01:48 PM
Well, there's is not ready-to-use tree view. Even if there is one it would be a pain to provide the containing data (due to immediate mode). But it's not impossible. You can create your own treeview. Just "some" labels/buttons/.... and you're done :D
Hi, I thought so too, Will roll my own, no problem. Tho I have a hard time believing that they also roll their own...
Answer by tgraupmann · Jun 06, 2011 at 03:32 PM
The tree view control is available in the Asset Store link text.
Here is a tree view control that will be available for Unity soon - link text
Doesn't work in editor windows, as $$anonymous$$ Fabre asked (and as I would've liked).
Hey now. I included an example scene that shows the tree view works in game, in the scene view, in a custom panel, and in an inspector. The control has a custom inspector.
Answer by Flickayy · May 18, 2014 at 01:53 AM
Sorry for the necro. But after trying to find a solution for my own needs I stumbled across this.
I believe you could achieve something similar to what you what, by manipulating the "EditorGUI.Foldout" function. You could create a function that makes nested foldouts as a workaround.
(Just for anyone else who stumbles across this like I did. Although it's not a copy&paste solution, it shouldn't be hard to implement.)
Answer by iwHiteRabbiT · Oct 01, 2014 at 10:53 AM
Hello,
I'm resurrecting this because I was recently looking for a solution too. Nevertheless, I really didn't find anything that matched my needs, so I made it myself and decided to sell it on the asset store.
You can find it under the name TreeView GUI.
I Hope this will meet your expectations.