Struct InputControlScheme.MatchResult
The result of matching a list of devices against a list of
requirements in an Input
Namespace: UnityEngine .InputSystem
Assembly: Unity.InputSystem.dll
Syntax
public struct InputControlScheme.MatchResult : IEnumerable<InputControlScheme.MatchResult.Match>, IEnumerable, IDisposable
Remarks
This struct uses Input
Properties
this[int]
Declaration
public InputControlScheme.MatchResult.Match this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index |
Property Value
Type | Description |
---|---|
Input |
See Also
devices
The devices that got picked from the available devices.
Declaration
public InputControlList<InputDevice> devices { get; }
Property Value
Type | Description |
---|---|
Input |
See Also
hasMissingOptionalDevices
Whether there are missing optional devices. This does not prevent a successful match.
Declaration
public bool hasMissingOptionalDevices { get; }
Property Value
Type | Description |
---|---|
bool | True if there are missing optional devices. |
See Also
hasMissingRequiredDevices
Whether there are missing required devices.
Declaration
public bool hasMissingRequiredDevices { get; }
Property Value
Type | Description |
---|---|
bool | True if there are missing, non-optional devices. |
See Also
isSuccessfulMatch
Whether the device requirements got successfully matched.
Declaration
public bool isSuccessfulMatch { get; }
Property Value
Type | Description |
---|---|
bool | True if the scheme's device requirements were satisfied. |
See Also
score
Overall, relative measure for how well the control scheme matches.
Declaration
public float score { get; }
Property Value
Type | Description |
---|---|
float | Scoring value for the control scheme match. |
Remarks
Two control schemes may, for example, both support gamepads but one may be tailored to a specific gamepad whereas the other one is a generic gamepad control scheme. To differentiate the two, we need to know not only that a control schemes but how well it matches relative to other schemes. This is what the score value is used for.
Scores are computed primarily based on layouts referenced from device requirements. To start with, each
matching device requirement (whether optional or mandatory) will add 1 to the score. This the base
score of a match. Then, for each requirement a delta is computed from the device layout referenced by
the requirement to the device layout used by the matching control. For example, if the requirement is
"<Gamepad>
and the matching control uses the Dual1/(delta+1)
is then added to the score. This means
that an exact match will add an additional 1 to the score and less exact matches will add progressively
smaller values to the score (proportional to the distance of the actual layout to the one used in the
requirement).
What this leads to is that, for example, a control scheme with a "<Gamepad>"
requirement
will match a Dual"<DualShockGamepad>"
requirement as the Gamepad layout is
further removed (i.e. smaller inverse delta) from Dual
See Also
Methods
Dispose()
Discard the list of devices.
Declaration
public void Dispose()
See Also
GetEnumerator()
Enumerate the match for each individual Input
Declaration
public IEnumerator<InputControlScheme.MatchResult.Match> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<Input |
An enumerate going over each individual match. |