I am currently doing a personal project, in which I wanted the UI elements in the scene to change depending on the type of controller being used. In my case, that it detects when it is an XBOX controller, PlayStation 5 and finally, keyboard and mouse.
First of all, I warn that this is my implementation and does not mean that it is the correct one or that it cannot be done otherwise. I accept suggestions and improvements, we are all here to learn.
The new Input System and version 2022.3 LTS will be used, and I have created the following main classes:
- GameManager: Enums are created here for the device type and the action being performed, to display the corresponding icon. In my example case, I use ACTIONS to know if it is an element to pick up, actuate, or talk, for example.
- InputManager: Variables and functions for collecting data from controllers.
- GameEvents: I use this class to create all the events that I am going to call, to have them all sorted in the same place.