Note that device requirements may require specific controls to be present rather than only requiring
the presence of a certain type of device. For example, a requirement with a controlPath
of "*/" will be satisfied by any device that has a control marked as PrimaryAction.
Requirements are ordered in a list and can combine with their previous requirement in either
AND or in OR fashion. The default is for requirements to combine with AND.
Note that it is not possible to express nested constraints like (a AND b) OR (c AND d). Also note that
operator precedence is the opposite of C#, meaning that OR has higher precedence than AND. This means
that a OR b AND c OR d reads as (a OR b) AND (c OR d) (in C# it would read as a OR
(b AND c) OR d.
More complex expressions can often be expressed differently. For example, (a AND b) OR (c AND d)
can be expressed as a OR c AND b OR d.
Properties
controlPath
Control path that is matched against a device to determine
whether it qualifies for the control scheme.
This is the default. For example, to require both a left hand and a right XR controller,
the first requirement would be for "<XRController>" and the second
requirement would be for ">XRController>" and would return true for this
property.
This allows designing control schemes that flexibly work with combinations of devices such that
if one specific device isn't present, another device can substitute for it.
For example, to design a mouse+keyboard control scheme that can alternatively work with a pen
instead of a mouse, the first requirement could be for "<Keyboard>", the second one
could be for "<Mouse>" and the third one could be for "<Pen>" and return true
for this property. Both the mouse and the pen would be marked as required (i.e. not isOptional)
but the device requirements are satisfied even if either device is present.
Note that if both a pen and a mouse are present at the same time, still only one device is
picked. In this case, the mouse "wins" as it comes first in the list of requirements.
isOptional
If true, a device with the given device path is employed by the
control scheme if one is available. If none is available, the control scheme is still
functional.
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.