1

I am developing a unity game and I want to make the light bar on a connected Dualshock controller change color when a player has taken damage. Could someone please inform me of a way to do this, as unity no longer supports this.

I tried to achieve this by using the following namespace and then change the color of the light bar using a method, but soon realized that unity has deprecated this feature a long time ago.

using UnityEngine.InputSystem.DualShock;

Thanks in advance!

EDIT: Unity does in fact support this, just on their NEW input system package (which my team don't have the time to upgrade to). So I guess my new question is: Is there a way to do this change the color of the dual-shock controller's light bar outside of unity programmatically and through code?

Thanks!

IBXCODECAT
  • 114
  • 12

1 Answers1

1

Try this !

var gamepad = (DualShockGamepad)Gamepad.all[0];
gamepad.SetLightbarColor(Color.red);

from here : https://forum.unity.com/threads/dualshock-4-lightbar.848707/

Edit: Also, you have to be using the "new" input system : https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Installation.html

NCarlson
  • 330
  • 2
  • 13
  • The posts on the unity forum seem to be from 2012 and 2013, and according to my research the **NEW** input system was not released until later. Are you sure that this wasn't depricated? – IBXCODECAT Jan 05 '22 at 02:18
  • 1
    Oh, nevermind. I understand now! Thanks for your help! – IBXCODECAT Jan 05 '22 at 02:23
  • Does anyone know a way to change the color of the Dualshock light bar outside of unity? – IBXCODECAT Jan 05 '22 at 13:54
  • As in, you want your own home-brewed game/engine (Directex/Vulcan or something?) to be able to change the color of the dualshock controller? or you want to use Unity, but without using UnityEngine.InputSystem? – NCarlson Jan 05 '22 at 15:02
  • I want to use unity, but without using the new input system. Is there a way that I could write a script in assembly or something to send data to the controller, without having to use the new input system? – IBXCODECAT Jan 05 '22 at 15:13
  • Basically could I create a script that is a StreamingAsset, and runs outside of unity to accomplish this? – IBXCODECAT Jan 05 '22 at 15:14
  • You may be able to do it, but it may require some work. I found this api on github that could be run outside of unity, but I'm not sure if it supports color, you may have to add it https://github.com/rdepena/node-dualshock-controller – NCarlson Jan 05 '22 at 15:19
  • What you want to do there is kinda re-inventing the wheel though, if you are using unity, you should use the InputSystem, as it is made for Unity. doing it yourself like that will be very difficult, and may not be a viable option for production/user facing products – NCarlson Jan 05 '22 at 15:24
  • That makes sense. The repository you showed me already supports color changing I think! If you look at the README.md here https://github.com/rdepena/node-dualshock-controller/blob/master/README.md you should find a section of code with color support. – IBXCODECAT Jan 05 '22 at 15:28