Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetAncestors(TIdentifier)

This method is e.g. used for revealing items that are currently under a collapsed item.
Read time 1 minuteLast updated 13 days ago

Definition

GetAncestors(T)

protected virtual IList<TIdentifier> GetAncestors(TIdentifier id)

Parameters

id

T
TreeViewItem ID.

Returns

Type

Description

IList<T>List of all the ancestors of a given item with ID id.

Remarks

It is called automatically from TreeView methods such as RevealItem. If the full item tree have not been built in BuildRoot(), you should override this method to use your backend data to find the correct ancestors for the given item otherwise RevealItem will fail.
Default behavior: The item with ID id is found by searching from the rootItem through all its descendants. Once found, its parent and its parent’s parent, etc. are collected as ancestors. This efault behavior assumes the full tree has been built.