Best of incontrol9/19/2023 Treat every app launch like it’s the first launch as far as attached devices are concerned. Persisting Device Settingsįor the reasons stated above, this is just not going to work. If you have a single player game, consider using input from InputManager.ActiveDevice which will allow the player to use any connected controller and even switch if she prefers. Of course, if you come up with a better solution, let me know! It may seem onerous to create the UI for this process but it is by far a more user friendly approach to this problem. Show this dialog on game start and when any attached/detached devices are detected. So how should you handle assigning controllers to players? My current advice is to have a dialog where users select their player using the controller they wish to use. Store the device object reference instead, and use InputDevice.IsAttached or InputManager.OnDeviceDetached to be notified when it is disconnected. Consider it a pool of devices from which players may be assigned. Please, please, don’t think of it that way. The point is, InputManager.Devices is not an array of players. There is, of course, also the potential situation of having more connected devices than intended players. I’ve even come across a webcam that reports itself as a controller. On occasion there could be phantom or unresponsive devices present. Devices are also not guaranteed to be in the order that any player lights on them may indicate. To make matters worse, Unity seems to place them in random order and the order may shuffle when a single device is attached/detached. I’m working on improving this in InControl in the future, but there is no perfect solution. As such, it is impossible to completely reliably identify a device between app launches, or changes of attached devices. Some platform-and-controller-specific APIs such as XInput do, but they are the exception. Devices and drivers simply do not make such a value available. Assigning Devices To Playersĭevices do not have a unique ID. If you absolutely must use them: make them optional, treat them like buttons and, maybe even use only one of them. Even the Xbox 360 controller will in some circumstances have both triggers on the same axis causing them to cancel each other out. Bottom line is, they’re just not reliable. Some controllers have them work differently on different platforms. Some controllers don’t have them, or they don’t work properly. Some controllers have sensitivity and noise issues. Some controllers or drivers have them work like buttons, not analogs. They’re also awkward to use without moving the stick accidentally. It’s not in Apple’s MFi spec, for example, so no MFi controller will have them. There are plenty of controllers that don’t have them even though they have sticks. So, if you will take some humble advice offered by a battle-scarred curmudgeon who has seen some small part of the unspeakable array of crazy controllers out there, it is this: Stick ButtonsĪvoid using stick buttons in your input design, or make them optional. Although InControl defines a set of “standardized” controls, picked only because they appear on major console controllers, they are anything but standard.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |