Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

AccessibilityNode

class in UnityEngine.Accessibility

/

Implemented in:UnityEngine.AccessibilityModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A node in the AccessibilityHierarchy representing a visual element, such as a UI element or an element that is part of your game, that needs to be accessible to the screen reader.


Accessibility nodes are data structures that enable screen readers to focus, announce and execute user actions on them. They represent visual elements in the application, but they exist and function independently of their corresponding visual elements. Changes to the visual representation of an element, such as its visibility, layering order or screen coordinates, do not affect the accessibility node that represents it.

To create an accessibility node, call AccessibilityHierarchy.AddNode on the hierarchy you want to add the node to. When calling this method, you can optionally specify the node's label and parent in the hierarchy. This method returns the created node. Use it to set different attributes and define the node's identity and functionality.

When a screen reader is active, users can navigate and interact with an application using specific gestures or commands that are easier to perform and prevent accidental actions. For this purpose, on mobile platforms, standard gestures, such as tap or swipe, do not work, or they perform different actions while the screen reader is on. Screen reader gestures and commands can vary across platforms, but they trigger the same accessibility events. For examples of gestures and commands on different platforms, refer to the Events section on this page. Subscribe to these events to detect user actions and to respond accordingly.

These APIs are currently supported on the following platforms:

- RuntimePlatform.Android - starting with Android 8.0 (API level 26) - RuntimePlatform.IPhonePlayer - RuntimePlatform.OSXPlayer - RuntimePlatform.WindowsPlayer

Additional resources:

Properties

Property Description
allowsDirectInteraction Whether the accessibility node allows direct touch interaction while the screen reader is active.
children The node's children in the accessibility hierarchy.
frame The bounding rectangle of the accessibility node in screen coordinates.
frameGetter Delegate that calculates the frame of the accessibility node, automatically keeping it up-to-date.
hint Additional guidance or context for interacting with the accessibility node.
id The unique identifier of the accessibility node.
isActive Whether the accessibility node is exposed to screen readers. The default value is true.
isFocused Whether the accessibility node is currently focused by the screen reader.
label A short description of the accessibility node.
parent The node's parent in the accessibility hierarchy.
role The type of user interface element that the accessibility node represents.
state The status of the visual element that the accessibility node represents.
value The value of the visual element that the accessibility node represents.

Public Methods

Method Description
GetHashCode A hash used for comparisons.
ToString Provides a debugging string.

Events

Event Description
decremented Event invoked when the user performs a "decrement" action when focused on the accessibility node.
dismissed Event invoked when the user performs a "dismiss" action when focused on the accessibility node.
focusChanged Event invoked on the main thread when the accessibility node gains or loses screen reader focus.
incremented Event invoked when the user performs an "increment" action when focused on the accessibility node.
invoked Event invoked when the user performs an "activate" action when focused on the accessibility node.
scrolled Event invoked when the user performs a "scroll" action when focused on the accessibility node.
selected Deprecated. Use AccessibilityNode.invoked instead.