Class Gamepad | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class Gamepad

    An Xbox-style gamepad with two switcks, a D-Pad, four face buttons, two triggers, two shoulder buttons, and two menu buttons.

    Inheritance
    System.Object
    InputControl
    InputDevice
    Gamepad
    DualShockGamepad
    XInputController
    Inherited Members
    InputDevice.kInvalidDeviceId
    InputDevice.description
    InputDevice.enabled
    InputDevice.canRunInBackground
    InputDevice.added
    InputDevice.remote
    InputDevice.native
    InputDevice.updateBeforeRender
    InputDevice.id
    InputDevice.lastUpdateTime
    InputDevice.wasUpdatedThisFrame
    InputDevice.allControls
    InputDevice.valueType
    InputDevice.valueSizeInBytes
    InputDevice.ReadValueFromStateAsObject(Void*)
    InputDevice.ReadValueFromStateIntoBuffer(Void*, Void*, Int32)
    InputDevice.CompareValue(Void*, Void*)
    InputDevice.ExecuteCommand<TCommand>(TCommand)
    InputControl.ReservedCharacters
    InputControl.name
    InputControl.displayName
    InputControl.shortDisplayName
    InputControl.path
    InputControl.layout
    InputControl.variants
    InputControl.device
    InputControl.parent
    InputControl.children
    InputControl.usages
    InputControl.aliases
    InputControl.stateBlock
    InputControl.noisy
    InputControl.synthetic
    InputControl.Item[String]
    InputControl.ToString()
    InputControl.EvaluateMagnitude()
    InputControl.EvaluateMagnitude(Void*)
    InputControl.WriteValueFromBufferIntoState(Void*, Int32, Void*)
    InputControl.WriteValueFromObjectIntoState(Object, Void*)
    InputControl.CompareState(Void*, Void*, Void*)
    InputControl.TryGetChildControl(String)
    InputControl.RefreshConfigurationIfNeeded()
    InputControl.RefreshConfiguration()
    InputControl.m_StateBlock
    InputControl.currentStatePtr
    InputControl.previousFrameStatePtr
    InputControl.defaultStatePtr
    InputControl.noiseMaskPtr
    InputControl.stateOffsetRelativeToDeviceRoot
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: UnityEngine.Experimental.Input
    Syntax
    public class Gamepad : InputDevice, IDualMotorRumble

    Properties

    aButton

    Same as buttonSouth.

    Declaration
    public ButtonControl aButton { get; }
    Property Value
    Type Description
    ButtonControl

    all

    A list of gamepads currently connected to the system.

    Declaration
    public static ReadOnlyArray<Gamepad> all { get; }
    Property Value
    Type Description
    ReadOnlyArray<Gamepad>
    Remarks

    Does not cause GC allocation.

    Do NOT hold on to the value returned by this getter but rather query it whenever you need it. Whenever the gamepad setup changes, the value returned by this getter is invalidated.

    bButton

    Same as buttonEast.

    Declaration
    public ButtonControl bButton { get; }
    Property Value
    Type Description
    ButtonControl

    buttonEast

    Declaration
    public ButtonControl buttonEast { get; }
    Property Value
    Type Description
    ButtonControl

    buttonNorth

    Declaration
    public ButtonControl buttonNorth { get; }
    Property Value
    Type Description
    ButtonControl

    buttonSouth

    Declaration
    public ButtonControl buttonSouth { get; }
    Property Value
    Type Description
    ButtonControl

    buttonWest

    Declaration
    public ButtonControl buttonWest { get; }
    Property Value
    Type Description
    ButtonControl

    current

    The gamepad last used by the user or null if there is no gamepad connected to the system.

    Declaration
    public static Gamepad current { get; }
    Property Value
    Type Description
    Gamepad

    dpad

    Declaration
    public DpadControl dpad { get; }
    Property Value
    Type Description
    DpadControl

    Item[GamepadButton]

    Declaration
    public ButtonControl this[GamepadButton button] { get; }
    Parameters
    Type Name Description
    GamepadButton button
    Property Value
    Type Description
    ButtonControl

    leftShoulder

    Declaration
    public ButtonControl leftShoulder { get; }
    Property Value
    Type Description
    ButtonControl

    leftStick

    Declaration
    public StickControl leftStick { get; }
    Property Value
    Type Description
    StickControl

    leftStickButton

    Declaration
    public ButtonControl leftStickButton { get; }
    Property Value
    Type Description
    ButtonControl

    leftTrigger

    Declaration
    public ButtonControl leftTrigger { get; }
    Property Value
    Type Description
    ButtonControl

    rightShoulder

    Declaration
    public ButtonControl rightShoulder { get; }
    Property Value
    Type Description
    ButtonControl

    rightStick

    Declaration
    public StickControl rightStick { get; }
    Property Value
    Type Description
    StickControl

    rightStickButton

    Declaration
    public ButtonControl rightStickButton { get; }
    Property Value
    Type Description
    ButtonControl

    rightTrigger

    Declaration
    public ButtonControl rightTrigger { get; }
    Property Value
    Type Description
    ButtonControl

    selectButton

    Declaration
    public ButtonControl selectButton { get; }
    Property Value
    Type Description
    ButtonControl

    startButton

    Declaration
    public ButtonControl startButton { get; }
    Property Value
    Type Description
    ButtonControl

    xButton

    Same as buttonWest

    Declaration
    public ButtonControl xButton { get; }
    Property Value
    Type Description
    ButtonControl

    yButton

    Same as buttonNorth.

    Declaration
    public ButtonControl yButton { get; }
    Property Value
    Type Description
    ButtonControl

    Methods

    FinishSetup(InputDeviceBuilder)

    Declaration
    protected override void FinishSetup(InputDeviceBuilder builder)
    Parameters
    Type Name Description
    InputDeviceBuilder builder
    Overrides
    InputControl.FinishSetup(InputDeviceBuilder)

    MakeCurrent()

    Declaration
    public override void MakeCurrent()
    Overrides
    InputDevice.MakeCurrent()

    OnAdded()

    Declaration
    protected override void OnAdded()
    Overrides
    InputDevice.OnAdded()

    OnRemoved()

    Declaration
    protected override void OnRemoved()
    Overrides
    InputDevice.OnRemoved()

    PauseHaptics()

    Declaration
    public virtual void PauseHaptics()

    ResetHaptics()

    Declaration
    public virtual void ResetHaptics()

    ResumeHaptics()

    Declaration
    public virtual void ResumeHaptics()

    SetMotorSpeeds(Single, Single)

    Declaration
    public virtual void SetMotorSpeeds(float lowFrequency, float highFrequency)
    Parameters
    Type Name Description
    System.Single lowFrequency
    System.Single highFrequency
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023