docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class DualShockGamepad

    A Sony DualShock/DualSense controller.

    Inheritance
    object
    InputControl
    InputDevice
    Gamepad
    DualShockGamepad
    DualShock4GamepadAndroid
    DualSenseGamepadHID
    DualShock3GamepadHID
    DualShock4GamepadHID
    DualSenseGampadiOS
    DualShock4GampadiOS
    Implements
    IDualShockHaptics
    IDualMotorRumble
    IHaptics
    Inherited Members
    Gamepad.buttonWest
    Gamepad.buttonNorth
    Gamepad.buttonSouth
    Gamepad.buttonEast
    Gamepad.leftStickButton
    Gamepad.rightStickButton
    Gamepad.startButton
    Gamepad.selectButton
    Gamepad.dpad
    Gamepad.leftShoulder
    Gamepad.rightShoulder
    Gamepad.leftStick
    Gamepad.rightStick
    Gamepad.leftTrigger
    Gamepad.rightTrigger
    Gamepad.aButton
    Gamepad.bButton
    Gamepad.xButton
    Gamepad.yButton
    Gamepad.triangleButton
    Gamepad.squareButton
    Gamepad.circleButton
    Gamepad.crossButton
    Gamepad.this[GamepadButton]
    Gamepad.all
    Gamepad.OnAdded()
    Gamepad.PauseHaptics()
    Gamepad.ResumeHaptics()
    Gamepad.ResetHaptics()
    Gamepad.SetMotorSpeeds(float, float)
    InputDevice.InvalidDeviceId
    InputDevice.description
    InputDevice.enabled
    InputDevice.canRunInBackground
    InputDevice.added
    InputDevice.remote
    InputDevice.native
    InputDevice.updateBeforeRender
    InputDevice.deviceId
    InputDevice.lastUpdateTime
    InputDevice.wasUpdatedThisFrame
    InputDevice.allControls
    InputDevice.valueType
    InputDevice.valueSizeInBytes
    InputDevice.ReadValueFromBufferAsObject(void*, int)
    InputDevice.ReadValueFromStateAsObject(void*)
    InputDevice.ReadValueFromStateIntoBuffer(void*, void*, int)
    InputDevice.CompareValue(void*, void*)
    InputDevice.OnConfigurationChanged()
    InputDevice.ExecuteCommand<TCommand>(ref TCommand)
    InputDevice.ExecuteCommand(InputDeviceCommand*)
    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.this[string]
    InputControl.magnitude
    InputControl.ToString()
    InputControl.EvaluateMagnitude()
    InputControl.EvaluateMagnitude(void*)
    InputControl.WriteValueFromBufferIntoState(void*, int, void*)
    InputControl.WriteValueFromObjectIntoState(object, void*)
    InputControl.TryGetChildControl(string)
    InputControl.TryGetChildControl<TControl>(string)
    InputControl.GetChildControl(string)
    InputControl.GetChildControl<TControl>(string)
    InputControl.RefreshConfigurationIfNeeded()
    InputControl.RefreshConfiguration()
    InputControl.m_StateBlock
    InputControl.currentStatePtr
    InputControl.previousFrameStatePtr
    InputControl.defaultStatePtr
    InputControl.noiseMaskPtr
    InputControl.stateOffsetRelativeToDeviceRoot
    InputControl.optimizedControlDataType
    InputControl.CalculateOptimizedControlDataType()
    InputControl.ApplyParameterChanges()
    Namespace: UnityEngine.InputSystem.DualShock
    Assembly: Unity.InputSystem.dll
    Syntax
    public class DualShockGamepad : Gamepad, IDualShockHaptics, IDualMotorRumble, IHaptics

    Properties

    L1

    The left shoulder button.

    Declaration
    public ButtonControl L1 { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Equivalent to leftShoulder.

    L2

    The left trigger button.

    Declaration
    public ButtonControl L2 { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Equivalent to leftTrigger.

    L3

    The left stick press button.

    Declaration
    public ButtonControl L3 { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Equivalent to leftStickButton.

    R1

    The right shoulder button.

    Declaration
    public ButtonControl R1 { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Equivalent to rightShoulder.

    R2

    The right trigger button.

    Declaration
    public ButtonControl R2 { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Equivalent to rightTrigger.

    R3

    The right stick press button.

    Declaration
    public ButtonControl R3 { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Equivalent to rightStickButton.

    current

    The last used/added DualShock controller.

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

    Equivalent to leftTrigger.

    optionsButton

    The right side button in the middle section of the controller. Equivalent to startButton.

    Declaration
    public ButtonControl optionsButton { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Same as startButton.

    shareButton

    The left side button in the middle section of the controller. Equivalent to selectButton

    Declaration
    public ButtonControl shareButton { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Same as selectButton.

    touchpadButton

    Button that is triggered when the touchbar on the controller is pressed down.

    Declaration
    public ButtonControl touchpadButton { get; protected set; }
    Property Value
    Type Description
    ButtonControl

    Control representing the touchbar button.

    Methods

    FinishSetup()

    Perform final initialization tasks after the control hierarchy has been put into place.

    Declaration
    protected override void FinishSetup()
    Overrides
    Gamepad.FinishSetup()
    Remarks

    This method can be overridden to perform control- or device-specific setup work. The most common use case is for looking up child controls and storing them in local getters.

    public class MyDevice : InputDevice
    {
    public ButtonControl button { get; private set; }
    public AxisControl axis { get; private set; }

             protected override void OnFinishSetup()
             {
                 // Cache controls in getters.
                 button = GetChildControl("button");
                 axis = GetChildControl("axis");
             }
         }</code></pre></example>
    

    MakeCurrent()

    Make the gamepad the current gamepad.

    Declaration
    public override void MakeCurrent()
    Overrides
    Gamepad.MakeCurrent()
    Remarks

    This is called automatically by the system when there is input on a gamepad.

    OnRemoved()

    Called when the gamepad is removed from the system.

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

    SetLightBarColor(Color)

    Set the color of the light bar on the back of the controller.

    Declaration
    public virtual void SetLightBarColor(Color color)
    Parameters
    Type Name Description
    Color color

    Color to use for the light bar. Alpha component is ignored. Also, RBG values are clamped into [0..1] range.

    Implements

    IDualShockHaptics
    IDualMotorRumble
    IHaptics

    Extension Methods

    InputControlExtensions.CheckStateIsAtDefault(InputControl)
    InputControlExtensions.CheckStateIsAtDefault(InputControl, void*, void*)
    InputControlExtensions.CheckStateIsAtDefaultIgnoringNoise(InputControl)
    InputControlExtensions.CheckStateIsAtDefaultIgnoringNoise(InputControl, void*)
    InputControlExtensions.CompareState(InputControl, void*, void*)
    InputControlExtensions.CompareState(InputControl, void*, void*, void*)
    InputControlExtensions.CompareStateIgnoringNoise(InputControl, void*)
    InputControlExtensions.FindControlsRecursive<TControl>(InputControl, IList<TControl>, Func<TControl, bool>)
    InputControlExtensions.FindInParentChain<TControl>(InputControl)
    InputControlExtensions.GetStatePtrFromStateEvent(InputControl, InputEventPtr)
    InputControlExtensions.HasValueChangeInEvent(InputControl, InputEventPtr)
    InputControlExtensions.HasValueChangeInState(InputControl, void*)
    InputControlExtensions.IsActuated(InputControl, float)
    InputControlExtensions.IsPressed(InputControl, float)
    InputControlExtensions.ReadDefaultValueAsObject(InputControl)
    InputControlExtensions.ReadValueAsObject(InputControl)
    InputControlExtensions.ReadValueFromEventAsObject(InputControl, InputEventPtr)
    InputControlExtensions.ReadValueIntoBuffer(InputControl, void*, int)
    InputControlExtensions.ResetToDefaultStateInEvent(InputControl, InputEventPtr)
    InputControlExtensions.WriteValueFromObjectIntoEvent(InputControl, InputEventPtr, object)
    InputControlExtensions.WriteValueIntoEvent<TValue>(InputControl, TValue, InputEventPtr)
    InputControlExtensions.WriteValueIntoState(InputControl, void*)
    InputControlExtensions.WriteValueIntoState<TValue>(InputControl, TValue, void*)
    InputControlExtensions.CopyState(InputDevice, void*, int)
    InputControlExtensions.CopyState<TState>(InputDevice, out TState)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)