- Home /
Selecting a Foldout Button? and Dragging it?
I'm trying to make a tool that will have hierarchy functionality along with some other custom behavior.
I can get the view working pretty well, using IndentLevel and Foldouts. However I want to be able to select items, and move them around (by dragging, same way it is done in the Hierarchy panel).
I know I'll have to manage the selections my self, which is fine.
How do I make a Foldout button that can be selected? ( just like the Hierarchy) and how to manage the drag and drop to rearrange the Hierarchy?
Is there anyway to actually just duplicate the Hierarchy, or subclass it and provide some custom behavior?
@skalev Did you ever find a solution for this? I am interested in implementing a similar GUI control.
Answer by skalev · Feb 26, 2015 at 02:46 AM
@zeenobit -> answering my own question so its documented.
I ended up drawing my own custom gui in an editor window.
To produce the "selection" I wrapped the folder call with a BeginHorizontal(), which returns a rect, which allows you to check if that part of gui was clicked. then, i would just update the GUIStyle the horizontal is using, so the background appears selected.
using this technique, you can apply any mouse operation to any "row" of your gui.
Sorry that I have no access to the code I wrote at the time to provide a sample.
Your answer
Follow this Question
Related Questions
Is it possible to detect drag and drop in hierachy window? 0 Answers
Find hierarchy object index OR figure out if an object is collapsed in the hierarchy window 0 Answers
Custom Hierarchy background rect lines 0 Answers
Highlighting / Focusing on an Editor Window Through Code 1 Answer
Hierarchy in editor 2 Answers