I’ve encountered an issue when trying to change the lightbar color of a DualShock 4 controller in my Unity project. I’m using the new Input System and attempted to change the color using DualShockGamepad.SetLightBarColor, but I’m having no success.
Here’s my code:
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.DualShock;
public class DS4Controller : MonoBehaviour
{
public void SetLightbar(Color requestedCollor)
{
var sonyGamepad = DualShockGamepad.current;
if (sonyGamepad != null)
{
sonyGamepad.SetLightBarColor(requestedCollor);
Debug.Log("Gamepad detected!" + " " + sonyGamepad);
}
}
void Start()
{
SetLightbar(Color.red);
}
I have a connected DualShock 4 gamepad (BT, no DS4Windows), and I’ve confirmed that the code is executing. However, the lightbar color remains unchanged.
I’m using Unity 2021.3.18f1 on win, and my project is set up to use the new Input System (1.4.4).
Please, can you advise me on what might be the issue and how I can correctly change the DualShock 4 lightbar color? Perhaps I missed something in the settings or need to enable additional features?