Class XInput
XInputDotNet wrapper behaviour for singleplayer-oriented xbox controller input sampling.
Bind your desired actions to the various button events in here.
Inheritance
Namespace: GlitchedPolygons.Input
Assembly: UnityScriptsLibrary.dll
Syntax
public sealed class XInput : MonoBehaviour
Fields
| Improve this Doc View SourceactivePlayerIndex
The active xbox controller slot.
Declaration
public PlayerIndex activePlayerIndex
Field Value
| Type | Description |
|---|---|
| PlayerIndex |
Properties
| Improve this Doc View SourceLeftThumbStickX
Horizontal axis value of the left joystick. [-1; 1]
Declaration
public float LeftThumbStickX { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
LeftThumbStickY
Vertical axis value of the left joystick. [-1; 1]
Declaration
public float LeftThumbStickY { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
LT
The left trigger's axis [0; 1]
Declaration
public float LT { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
RightThumbStickX
Horizontal axis value of the right joystick. [-1; 1]
Declaration
public float RightThumbStickX { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
RightThumbStickY
Vertical axis value of the right joystick. [-1; 1]
Declaration
public float RightThumbStickY { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
RT
The right trigger's axis [0; 1]
Declaration
public float RT { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
| Improve this Doc View SourceIsControllerConnected(PlayerIndex)
Returns whether the specified controller is currently connected or not.
Declaration
public bool IsControllerConnected(PlayerIndex playerIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerIndex | playerIndex | The controller's player index (One = top left quadrant on the xbox controller's ring of light, Two = top right, etc...) |
Returns
| Type | Description |
|---|---|
| System.Boolean |
StopVibration()
Immediately stop the xbox controller's vibration.
Declaration
public void StopVibration()
Vibrate(Single, Single, Single)
Make the xbox controller vibrate over a given amount of seconds.
Declaration
public void Vibrate(float duration, float leftMotor = 1F, float rightMotor = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | duration | |
| System.Single | leftMotor | |
| System.Single | rightMotor |
Events
| Improve this Doc View SourceButtonPressed
This event is raised when the currently active xbox controller detects a button press.
The pressed XboxControllerButton is passed as a function parameter.
Declaration
public event Action<XboxControllerButton> ButtonPressed
Event Type
| Type | Description |
|---|---|
| System.Action<XboxControllerButton> |
ButtonReleased
This event is raised when any XboxControllerButton was released (after being held down) from the currently active xbox controller.
The released XboxControllerButton is passed as a function parameter.
Declaration
public event Action<XboxControllerButton> ButtonReleased
Event Type
| Type | Description |
|---|---|
| System.Action<XboxControllerButton> |
ControllerConnected
This event is raised whenever the current controller (specified by the active player index) is (re)connected.
Declaration
public event Action ControllerConnected
Event Type
| Type | Description |
|---|---|
| System.Action |
ControllerDisconnected
This event is raised when the currently active controller is disconnected.
Declaration
public event Action ControllerDisconnected
Event Type
| Type | Description |
|---|---|
| System.Action |