Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AccessibilityHierarchy

Represents the hierarchy data model that the screen reader uses for reading and navigating the UI.
Read time 2 minutesLast updated 15 days ago

Definition

public class AccessibilityHierarchy

Remarks

A hierarchy must be set to active through AssistiveSupport.activeHierarchy when the screen reader is on for the screen reader to function. If a hierarchy is not set active, the screen reader cannot read and navigate through the UI. Once an active hierarchy is set, if the hierarchy is modified, the screen reader must be notified by calling SendLayoutChanged or SendScreenChanged (depending if the changes are only at the layout level, or a more considerable screen change). Modifications in the hierarchy consist of calls to:

Constructors

Constructor

Description

AccessibilityHierarchy()Initializes and returns an empty AccessibilityHierarchy.

Properties

Property

Description

rootNodesThe root nodes of the hierarchy.

Methods

Method

Description

AddNodeCreates and adds a new node with the given label in this hierarchy under the given parent node. If no parent is provided, the new node is added as a root in the hierarchy.
ClearResets the hierarchy to an empty state, removing all the nodes and removing focus.
ContainsNodeReturns whether a given node exists in the hierarchy.
GetLowestCommonAncestorRetrieves the lowest common ancestor of two nodes in the hierarchy. The lowest common ancestor is the node that is the common node that both nodes share in their path to the root node of their branch in the hierarchy.
InsertNodeCreates and inserts a new node with the given label at the given index in this hierarchy under the given parent node. If no parent is provided, the new node is inserted at the given index as a root in the hierarchy.
MoveNodeMoves the node elsewhere in the hierarchy, which causes the given node to be parented by a different node in the hierarchy. An optional index can be supplied for specifying the position within the list of children the moved node should take (zero-based). If no index is supplied, the node is added as the last child of the new parent by default.
RefreshNodeFramesRefreshes all the node frames (i.e. the screen elements' positions) for the hierarchy.
RemoveNodeRemoves the node from the hierarchy. Can also optionally remove nodes under the given node depending on the value of the removeChildren parameter.
TryGetNodeTries to get the node in this hierarchy that has the given ID.
TryGetNodeAtTries to retrieve the node at the given position on the screen.