Click or drag to resize

InputStateExtFindFirstHeld Method (InputState, IDevice, IVirtualAxis, InputCode)

[This is preliminary documentation and is subject to change.]

Overload of FindFirstHeld(InputState, IDevice, IVirtualAxis) that limits the search to selected axes, given as params argument. Use this form if you're specifying input codes manually.

Namespace:  RavingBots.MultiInput
Assembly:  RavingBots.MultiInput (in RavingBots.MultiInput.dll) Version: 0.12
Syntax
C#
public static bool FindFirstHeld(
	this InputState state,
	out IDevice foundDevice,
	out IVirtualAxis foundAxis,
	params InputCode[] axes
)

Parameters

state
Type: RavingBots.MultiInputInputState
InputState instance.
foundDevice
Type: RavingBots.MultiInputIDevice
If this method returned true, set to the found device. Otherwise, set to null.
foundAxis
Type: RavingBots.MultiInputIVirtualAxis
If this method returned true, set to the found axis. Otherwise, set to null. You can check the axis code via Code property.
axes
Type: RavingBots.MultiInputInputCode
Axes to search through.

Return Value

Type: Boolean
true if IsHeld was true for at least one axis, false otherwise.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type InputState. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
The following example shows how you can use this method to find first held PadLeftTrigger or PadRightTrigger axis.
var state = FindObjectOfType<InputState>();
IDevice device;
IVirtualAxis axis;
if (state.FindFirstHeld(out device, out axis, InputCode.PadLeftTrigger, InputCode.PadRightTrigger)) {
    Debug.LogFormat("Found held trigger on device {0}, axis {1}", device.Name, axis.Code);
} else {
    Debug.LogFormat("Held trigger not found");
}
See Also