Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

TreeViewAttribute

A topic by CatyboyStudio created Oct 14, 2022 Views: 78
Viewing posts 1 to 1

Select the data using UIElements TreeView (Unity 2021.1 or later)

[TreeView(nameof(Data), true)]
public int TreeValue1;
 
private TreeViewNode Data()
{
  var root = new TreeViewNode();
  root.Add(1, "Node1");
  root.Add(2, "Node2");
  var n3 = root.Add(3, "Node3");
  n3.Selectable = false;
  n3.Add(4, "Level1");
  n3.Add(5, "Level2");
  root.Add(6, "Node4");
  return root;
}

TreeView's data sources support properties and methods that return a value of TreeViewNode

When the “refreshButton” parameter is True, a “R” button will appear next to the control, and the tree nodes can be refreshed after clicking

When the “refresher” parameter is associated with a property, the tree nodes can be refreshed after the refresher property changed