Class DualShock4GamepadAndroid
A PlayStation DualShock 4 controller connected to an Android device.
Inherited Members
Namespace: UnityEngine.InputSystem.Android
Assembly: Unity.InputSystem.dll
Syntax
public class DualShock4GamepadAndroid : DualShockGamepad, IDualShockHaptics, IDualMotorRumble, IHaptics
Methods
OnAdded()
Called by the system when the device is added to devices.
Declaration
protected override void OnAdded()
Overrides
Remarks
This is called after the device has already been added. devicesAddedOnRemoved()
Examples
using UnityEngine.InputSystem;
public class MyDevice : InputDevice
{
public static MyDevice current { get; private set; }
protected override void OnAdded()
{
// use this context to assign the current device for instance
base.OnAdded();
current = this;
}
}
OnRemoved()
Called by the system when the device is removed from devices.
Declaration
protected override void OnRemoved()
Overrides
Remarks
Examples
using UnityEngine.InputSystem;
public class MyDevice : InputDevice
{
public static MyDevice current { get; private set; }
protected override void OnRemoved()
{
// use this context to unassign the current device for instance
base.OnRemoved();
if (current == this)
current = null;
}
}
SetLightBarColor(Color)
Set the color of the light bar on the back of the controller.
Declaration
public override 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. |
Overrides
Remarks
On Android, the light bar color can only be set over Bluetooth on Android 13 or later. When the application exits, the light bar shows the color another running application set, or turns off if none did. Another application can change the color; the Input System sets the last color again when the application gets focus.