Show / Hide Table of Contents

Class XInput

XInputDotNet wrapper behaviour for singleplayer-oriented xbox controller input sampling.

Bind your desired actions to the various button events in here.

Inheritance
System.Object
XInput
Namespace: GlitchedPolygons.Input
Assembly: UnityScriptsLibrary.dll
Syntax
public sealed class XInput : MonoBehaviour

Fields

| Improve this Doc View Source

activePlayerIndex

The active xbox controller slot.

Declaration
public PlayerIndex activePlayerIndex
Field Value
Type Description
PlayerIndex

Properties

| Improve this Doc View Source

LeftThumbStickX

Horizontal axis value of the left joystick. [-1; 1]

Declaration
public float LeftThumbStickX { get; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

LeftThumbStickY

Vertical axis value of the left joystick. [-1; 1]

Declaration
public float LeftThumbStickY { get; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

LT

The left trigger's axis [0; 1]

Declaration
public float LT { get; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

RightThumbStickX

Horizontal axis value of the right joystick. [-1; 1]

Declaration
public float RightThumbStickX { get; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

RightThumbStickY

Vertical axis value of the right joystick. [-1; 1]

Declaration
public float RightThumbStickY { get; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

RT

The right trigger's axis [0; 1]

Declaration
public float RT { get; }
Property Value
Type Description
System.Single

Methods

| Improve this Doc View Source

IsControllerConnected(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
| Improve this Doc View Source

StopVibration()

Immediately stop the xbox controller's vibration.

Declaration
public void StopVibration()
| Improve this Doc View Source

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 Source

ButtonPressed

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>
| Improve this Doc View Source

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>
| Improve this Doc View Source

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
| Improve this Doc View Source

ControllerDisconnected

This event is raised when the currently active controller is disconnected.

Declaration
public event Action ControllerDisconnected
Event Type
Type Description
System.Action
  • Improve this Doc
  • View Source
Back to top Generated by DocFX