If the tree represents Unity objects, use GetInstanceID for each object as the ID for the TreeViewItem. The ID is used for finding items in the tree for the selection state, expanded state, and navigation. Each TreeViewItem must be constructed with a unique integer ID (unique among all the items in the TreeView). TreeViewItem ( TreeViewItem) contains data about an individual TreeView item, and is used to build the representation of the tree structure in the Editor. For an example of a class containing a TreeViewState field, see Example 1: A simple TreeView, below. More info See in Glossary or entering Play mode (see documentation on extending the Editor for information on how to do this). Add the TreeViewState as a field in your EditorWindow-derived class to ensure that user-changed states are not lost when reloading scripts A piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. The TreeView itself is not serializable - it is reconstructed from the data that it represents when it is constructed or reloaded. TreeViewState is the only state that is serializable. TreeViewState ( TreeViewState) contains state information that is changed when interacting with TreeView fields in the Editor, such as selection state, expanded state, navigation state, and scroll state. The most important classes aside from the TreeView itself are TreeViewItem and TreeViewState. This item is the root of all other items. The TreeView has a single root TreeViewItem which is hidden and does not appear in the Editor. Each TreeViewItem contains parent and children information, which is used by the TreeView to handle navigation (key and mouse input). The rendering of the TreeView is handled by determining a list of expanded items called rows. This can be a C# tree model, or a Unity-based tree structure like the Transform hierarchy. You can construct TreeView using any tree data structure you prefer. Note that the TreeView is not a tree data model. Example of a TreeView with a MultiColumnHeader and a SearchField. See Unity Scripting API documentation on TreeView for information about the available TreeView API functions. Use TreeView to create highly customizable list views and multi-column tables for Editor windows, which you can use alongside other IMGUI controls and components. ![]() TreeView is an IMGUI control used to display hierarchical data that you can expand and collapse. For information about IMGUI and customizing Editor windows, refer to Extending the Editor and the IMGUI Unity blog. ![]() The information on this page assumes the reader has basic knowledge of IMGUI (Immediate Mode GUI) concepts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |