Search Unity

Rewired - Advanced Input for Unity

Discussion in 'Assets and Asset Store' started by guavaman, Sep 25, 2014.

  1. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    Close and reopen the Unity editor if you ever initialize Steam in the project. Once it has been hooked by Steam, it is hooked until it is closed.

    There is nothing I can do if it's not working. It should be. There is not reason why it wouldn't. The device sends and receives HID communication the same way whether it's in the Unity editor or in a build. There isn't any setting you can change and nothing I can change in code that will affect this.

    It could easily be something else entirely you're not expecting like an additional controller showing up and getting assigned to the Player that is displacing the DS4. Follow this guidance:

    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#controller-doesnt-work
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    Thanks for your thoughts. I won't be changing the default settings. They have worked well for over 10,000 developers for over 7 years and many hundreds of games. I have had zero complaints about this before yours.

    Rewired was designed to solve the problems of multiplayer games. Hundreds of multiplayer games use Rewired. I have no data to show one way or another whether more single or multiplayer games use Rewired.

    Then they should not be using Rewired. It's as simple as that. It was never my intention to design an input system for developers who just want to click a couple of buttons and go without putting any effort into understanding what they're using. Those developers are not, never have been, and never will be my target market. Those kinds of users are a huge support burden precisely because they don't spend any time to understand what they're using. Rewired is a professional-level input system and is designed as such for experienced developers and those willing to learn. Taking on the responsibility of saving lazy people from themselves is a losing battle. It is never enough no matter how much you do.

    I spent months writing the most comprehensive documentation that I possibly could write. That was a huge effort. I have no obligation or desire to eliminate the responsibility of the developer to spend some time to learn about the system they're using.

    In the documentation:
    https://guavaman.com/projects/rewired/docs/HowTos.html#changing-configuration-settings-at-runtime

    https://guavaman.com/projects/rewir...eInput_ConfigHelper_maxJoysticksPerPlayer.htm

    Rewired has no ini file and it does not write any configuration data to any location on its own. The configuration is set by the developer in the Unity editor. Runtime configuration management is up to the developer to implement if they want to use it in that matter. Rewired can't hook into the command line arguments of the exe. This is not possible.If the developer wants to implement some kind of ini file to change their settings, they can do so.

    If they followed the recommended best practices in the first place, there would be a way to manually assign and unassign controllers and there would be no issue with 3rd party input drivers / mappers like DS4Win conflicting with Steam causing controller assignment issues. I even provide a drop-in controller remapping system that offers that very feature so they don't have to do a darn thing.

    It's also a false assumption to believe setting joysticks to 100 per Player will solve all joystick assignment problems in single player games. It won't. It can and does cause its own set of problems under some circumstances. One real scenario that has happened before is some real or virtual device that reports non-zero element values causing phantom input (say they left a remote control or steering wheel connected or have some 3D mouse driver that creates a joystick device). If there is an Unknown Controller map that binds axis 0 to some action like moving the player, if some virtual or real device is attached, it can and will produce input when all the controllers are assigned to the Player. Or, at the very least, may take over the last active controller if some axis is noisy. Another case is when a single device is displayed to the system as two devices (real and virtual) but their mappings aren't identical. Pressing X on the device may generate two different values, one for each controller, both assigned to the same Player. This is especially true of Steam control rebinding is involved. X may be bound to Jump on the virtual device and Fire on the real device because of rebinding. The variety of scenarios where improperly detected virtual devices can cause problems is endless. You still need a way to unassign that controller from the Player or you WILL have users who will run into problems. There's no way around it. There are just too many possible software and hardware configurations in the wild on PCs. The user must be able to define exactly which controllers they want to use and don't want to use to control the game.
     
    Last edited: Aug 10, 2021
  3. libra34567

    libra34567

    Joined:
    Apr 5, 2014
    Posts:
    44

    Thanks for the reply!

    Regarding steam, I tested to close steam and restart unity. Including disable steam's start on windows startup. Won't help.

    Regarding Debug Information Tool. I went thro the list from your link everything seems correct.

    There's one thing I noticed. In Settings/Windows/Primary Input source. By default its RawInput. Which is not working. But once I change it to directInput. The controller is working again. (But not Rumble/vibration which I definitely need). Does that information help? Let me know!
     
  4. liandris

    liandris

    Joined:
    Mar 23, 2021
    Posts:
    8
    Thanks for still following...
    If feedback is not mandatory you might never get the picture. Just like users may not post any meaningful reports anywhere (and go and refund the game instead for example), developers may not let you know about problems they are having and try something else instead.
    Also, the issue might actually be relatively new, if it's a regression in Steam.

    My impression is that at least 60% of all games that use Rewired are SP games. I may be wrong, but it's possible that I played more single-player Unity-based games than you recently.

    Well after they made their choice it's no use to tell what they had to do instead. I made a random search query and found a small discussion on reddit where your plugin is recommended by several people without outlining how it's specifically designed for multiplayer games. I mean you might not be able to fully control how people perceive your product. If your plugin is very popular, well-priced and works adequately for single-player games, then more people will use it for single-player games in future. Multi-player games are just getting created less frequently.

    This is somewhat helpful, but from what I've checked now it seems like some of relevant code in Rewired might be encrypted, making it more difficult to analyze... Set/get functions are never called, which indicates the value is left at default. Not sure if it's going to be easily possible to fix such games manually at this point.

    I want to reiterate again that my experience shows that this conflict is caused by Steam, not by 3rd party software. I have Steam Input fully disabled wherever possible, and still it tries to hook a virtual device into the game.

    I assume you mean that menu where players can redefine buttons. Still I only saw it in a couple of games, maybe because they don't like spending time on it.

    Well with several real devices - obviously removing or unplugging one would solve the issue. It's much less problematic than a case where you got one real gamepad and it doesn't seem to work.

    I agree that user must be able to set up his devices and controls as he likes, but such developers prevent it from happening sometimes.

    Do I get it right? Developers should implement a code that would detect which gamepad is first used and auto-assign it to player 1? Otherwise something like "get device number 1 and assign it to player 1" might look really bad even for default case.
     
  5. KD_W

    KD_W

    Joined:
    Feb 9, 2015
    Posts:
    9
    Hi I'm new to this.
    If I use player.GetButton("someAction"), is there a way to find out this button is a mouse button? thank you
     
  6. LukeFireproof

    LukeFireproof

    Joined:
    Jan 21, 2016
    Posts:
    12
    Hey, figured this out (sort of). The crash ended up being reproducible by changing code while in playmode, then leaving playmode. We were calling some of our code in OnDisable that sneakily created a new Rewired Prefab when the scene was destroyed. Not sure why changing code at runtime caused the crash specifically but we've fixed it for now. Thanks for your help!
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    Running Steam in the background without initializing Steam through Steamworks.Net or something else will not impact the Unity editor in any way. Only if Steam is being initialized by the application will Steam affect its input.

    Raw Input and Direct Input primary input sources use the exact same code for initializing and working with special devices with Enhanced Device Support like the DS4. The code is identical. Something else is happening.

    Using Debug Information with Raw Input as the chosen Primary Input Source, open the DS4 controller under Controllers -> Sony DualShock 4 and post a screenshot of everything it shows.

    Next, open the Rewired/DevTools/JoystickElementIdentfier scene and press Play. Show a screen shot of what that shows you.
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
  9. liandris

    liandris

    Joined:
    Mar 23, 2021
    Posts:
    8
    Here is another idea...
    Another recent game (Eldest Souls) got released with a variation of the issue around "Max Joysticks Per Player". With DS4Windows + Steam the input works great, but there is a problem where the game is unable to display correct button prompts and instead shows some kind of stock generic image for a button. Developers said the game tries to identify the device ID and link the needed images with a hash table. If a button is displayed it should mean some ID was detected and processed. So since that virtual device made by Steam can be read, then it has some ID that can be read and interpreted. Then it can be blacklisted when assigning devices. Its ID should be very different from usual gamepads if it can't be identified as either Xbox or PS device, so I'm not expecting downsides.

    Can this be viable?
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    • They have access to a 100% fully functioning free trial to evaluate Rewired for an unlimited amount of time on all platforms Rewired supports before they buy it.
    • They have access to all the documentation, these forums, website, and even pre-sales support before they buy it.
    • The Unity Asset Store processes refunds without question for the majority of cases within some time period after purchase.
    The documentation clearly states on the front page of the documentation:

    Nobody can justifiably make the claim they bought Rewired without the ability to know exactly what they were byuing and what would be required to use it.

    If a developer chooses to use Rewired and chooses not to read the documentation or understand the system thoroughly, or if they choose to not follow the best practices given to them, that is 100% their choice and how they chose to use the system. Rewired is not a black box. Developers are free to use it however they want.

    You are trying to fix their oversights after the fact, and telling me I should rework my system to prevent them from making such oversights in the first place because I am not doing enough to ensure they configure the system correctly, even through my documentation already gives clear guidance. I don't agree with that premise.
     
    Last edited: Aug 13, 2021
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    What you're describing is right out of the Rewired documentation:
    https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action

    What they are saying is that they only support specific devices that can be positively identified and recognized and every other device is ignored. No support for unrecognized controllers. They just lost half the value of Rewired right there. That's an enormous downside. If a controller cannot be recognized (and there are thousands of them out there that can never be), it cannot be used. That would be unacceptable to me if I were developing that game, and I'm sure it would be unacceptable to quite a number of players as well.

    If the only controllers you are interested in supporting are XInput-compatible devices (or Steam virtual controllers pretending to be XInput devices, including DS4, Switch Pro Controller, etc.) you can download XInputDotNet and have perfect XInput controller support for free, and nothing else. Most users will be happy, and a few will be angry. One of the most compelling reasons to buy Rewired is to have support for nearly every controller under the sun, including controllers that Rewired doesn't explicitly support, and controllers that may be released long after the game is released, and even after the game is no longer maintained. You can't do this if you are throwing out everything that can't be matched to a controller definition.

    There is only one correct solution to this and other variations of this problem -- allow users to assign and unassign controllers manually to/from Players. There is no "automagic" way to correct these issues which are caused by outside factors manipulating the input API in unknowable ways. Every clever workaround solution will fail in some way or cause unintended side effects because you have to make assumptions as to the specific manifestation of the virtual controller issue. There are many different but related scenarios that I have seen happen over the years, each with their own idiosyncrasies. Spackle cannot fix structural failures.
     
    Last edited: Aug 13, 2021
  12. liandris

    liandris

    Joined:
    Mar 23, 2021
    Posts:
    8
    I was not telling you what you should do. I think it's different. You know better than many people how some developers knowingly or unknowingly break certain stuff in their games, then don't provide any good fix. You probably know too that PC community is full of user-generated content, including game-specific fixes for many things like non-critical problems and game-breaking bugs. You can consider me a part of that community too, as I'd like to see obvious issues fixed where possible. Developers are not robots and failing to provide a proper fix is not always the result of their negligence, but might be the result of the issues in their personal lives. It's easy to blame them for their mistakes, but it doesn't help anyone. If there is any way to make their games work for more users and solve general issues - it's only logical to want to do that. So, I was telling you may be able to contribute into that, if you feel like it.

    I could also put it differently, like trying to convince you that it's actually a bug or unwanted behavior. Maybe even with your experience it's a new issue. Like, why does the plugin prefers to read data from an unknown controller with possibly broken or empty ID? I'm now asking developers for the information they could provide about this - the ID of that controller created by Steam. But they will likely not be able to help with this.

    I'm sorry but you misinterpreted what I said. I said that the input works, only that button prompts are broken (I just assumed they only got 2 sets of images, and that was wrong). Now it seems obvious why - they are using the "ReIconed for ReWired" plugin. Whether it's the issue of this exact plugin or their own mistake in trying to fix its issues - I don't know yet, but it's obvious that the code piece for actual input support is working correctly and the code piece for identifying the controllers in order to decide which UI element to show suffers from the problem related to MaxJoysticksPerPlayer.

    I'm sorry if it looks like I should learn more about Unity, Rewired and controllers. I'm not a game developer. But I consider my experience enough to make logical assumptions and conclusions from basic troubleshooting. The problem is certainly on Steam here. Even if Valve acknowledges this bug/regression, with their current focus on Steam Deck and possibly new controller, they may never really solve this (there are also clues that they need it for Remote Play). We'll be stuck with a major game client that tries to plug its own virtual controller into every game which user may not always want to use.

    Why am I even posting here then? Rewired is only a plugin after all. Well, that's because in my experience with many games recently, I found that a noticeable portion of games suddenly started to ignore my controller, and I found the connection - they all use Rewired. Rewired seemed the best place to fix this exact problem, for now.

    Other games don't have this issue from my experience. If I run a non-Unity game from Steam that allows to select a gamepad device from the drop-down list, there won't be any additional devices in the list, whether they support Xinput only or Dinput only, or both. Only Rewired happen to stumble into that virtual controller and prefer it over my real pad. This doesn't seem correct to me.

    I think it's much less viable to ask every affected developer to do this.
     
  13. ryderstudiosgamedev

    ryderstudiosgamedev

    Joined:
    Sep 22, 2020
    Posts:
    1
    Hey there, so I've been searching for this for a bit and I didn't found anything. I'm currently making a tutorial for my game and I want to display which buttons the player needs to press for which action (shooting, dashing, ...), but for different input devices (Keyboard,XBox Controller, PS4 controller, ...) I need to display other icons of course. Is there a way to change the sprite to the one fitting to the currently connected controller (or if there's none the keyboard) ?
     
  14. Kerrjgan

    Kerrjgan

    Joined:
    May 30, 2016
    Posts:
    9
    Rewired: The version of Rewired installed (1.1.39.3.U2020) was not designed for Unity 2021. Please install Rewired for Unity 2021.

    I believe I'm using the latest version of Rewired. Asset store page suggests 2021 is supported. Where can I get a 2021 build? Thanks :)
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    This is in the documentation:
    https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    There are several things you are misunderstanding.

    There is no broken or empty id that can be used to detect this issue. The ID the developer was referring to was the Rewired joystick hardware type identifier. This is purely a Rewired ID generated by Rewired. It does not come from the HID device or the input API. It cannot be used to detect whether some controller is broken or not. It is an id that is used to tell whether the controller matches up to a predefined controller definition. Is it "recognized" or "unknown." If it's recognized, it's one of these and has a non-zero hardware type guid:
    https://guavaman.com/projects/rewired/docs/SupportedControllers.html

    If it's not recognized, it's an Unknown Controller:
    https://guavaman.com/projects/rewired/docs/ControllerMaps.html#unknown-controllers

    The "empty" id is Guid.Empty -- a Guid made up of all 0's. This is what Rewired uses to signify an "Unknown Controller."

    This does not mean the controller is broken, nor does it mean Rewired can know anything special about this controller. As far as the HID information tells it, it is a valid controller. All it means is it doesn't match up to one of the definitions that comes with Rewired. It would incorrect to blacklist controllers simply because they're not recognized or recognizable as they can be supported through mapping at runtime by the end user.

    The information you are hoping to find to identify the duplicate dead controller that's showing up in order to blacklist it simply does not exist. There is no information that can be used to identify a broken controller or the controller that Steam is inadvertently exposing due to whatever new bug they introduced in the Steam client.

    It would take a great deal of time and energy to explain all of the information that is available from Raw Input, Direct Input, XInput, and HID for identifying devices and how Steam creates virtual devices exposing them through 3 different input APIs and exposes information to tell applications which Raw Input and Direct Input devices to ignore so your application doesn't expose redundant devices, and how this correlates to Rewired device recognition, what devices it exposes, the order in which different devices handled by different APIs are created and assigned to Players, etc. Suffice it to say, I'm extremely familiar with all the steps involved, and what you are attempting to do -- detect and ignore this dead device -- is not possible.

    Similar to above, you're misunderstanding what's happening.
    • ReIconed follows the examples in the documentation for displaying glyphs.
    • The documentation states to support glyphs for certain important recognized controllers and fallback to a general set of icons for unrecognized controllers or less important controllers.
    • Multiple controllers are being exposed to Rewired -- one that is recognized and one that is unrecognized (empty hardware type guid).
    • The game in question you're talking about was assigning multiple controllers to the same Player because MaxJoysticksPerPlayer is greater than 1. Both the recognized controller and the unrecognized controller.
    • The code the developer used to display glyphs must be calling a function that gets the glyph for the FIRST binding of particular action and displays that glyph to the user. Because two controllers are assigned to the Player and both have bindings, it just so happens that the first glyph it finds is for the unrecognized controller so it shows the generic glyph.
    • The only reason this happens is that two controllers are being exposed for the same controller and both are being assigned to the Player..
    • The reason input still works in this case is because both the working and non-working controllers are assigned to the same Player. Rewired will use input from all controllers assigned to the Player..
    • A more robust way of handling glyphs for multiple controllers assigned to the same Player is to detect the last active controller used by the player, then show glyphs for that controller. Blacklisting the controller and removing it from the Player because it's an "Unknown Controller" in order to hide it from having its glyphs shown is a very bad way to solve the problem.

    I've said multiple times that the DS4 + Steam bug you're trying to patch over in the application isn't possible to fix in any sort of robust, foolproof way that won't have any unintended consequences or manifest in a different way under other circumstances that can't be detected or fixed in the same manner. I also very strongly believe that it is not the responsibility of the application to fix bugs in Steam, and even that is would be very bad design to attempt to do so. Every single time I've done that in the past, it causes way more problems than it solves, introduces new unintended side effects in other scenarios, and makes the application brittle and prone to breaking when Steam changes things or fixes their problems. Then it becomes a game of cat and mouse, changing my code and releasing updates as they fix and make new bugs or change how things work time and time again. And of course, the developer has to continuously update Rewired as well. Steam wants to be in charge of input, and you must let it be and not try to fight against it, otherwise you'll be in for a world of constant pain. Believe me, I've been through this ride before with Steam many times. I'm not going there again. It's just wrong to patch over issues in dependencies this way. I'm saying this with a great deal of knowledge about how Windows input APIs work, how HID devices work, how Steam's controller system works, and how Rewired works. I'm not telling you you need to know more about Unity, input, Rewired, or anything else. You're not accepting that I know what I'm talking about, so I'm explaining all these details so you will understand why the problem is more complicated than it seems and why the solutions you're proposing either aren't possible or won't solve the problem. Rewired is not the source of the problem, and therefore the solution does not lie with Rewired. There is only one solution -- fix the bug at its source.

    Rewired supports Raw Input, Direct Input, and XInput. Raw Input is the default primary input source. Raw Input and Direct Input are not the same thing and have very different APIs and capabilities. Comparing a game using Raw Input to a game using Direct Input is not an equivalent comparison.

    Steam has to expose different virtual devices each of Raw Input, Direct Input, and XInput. Each one is a different code path. It is entirely possible their code that creates the virtual device for Raw Input is broken and exposing a device that shouldn't be exposed or not hiding the original HID device. This would not affect a game that uses Direct Input.

    I can confirm this issue is not present without DS4Win in the mix as I am able to run my Steam test application in the latest Steam beta client using Raw Input with a DS4 controller and only one device shows up in Rewired. I can also confirm this is the case whether Steam's Playstation Configuration Support option is enabled or disabled. When it's disabled, only the HID device appears. When it's enabled, only the Steam virtual device appears. If you want Steam games to work properly at this time without some kind of fix from Steam, uninstall DS4Win.
     
    Last edited: Aug 18, 2021
  18. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    155
    Hi, Apologies for the bother. I just wanted to check how to go about setting up Rewired for Multiplayer. I'm using Ultimate Character Controller and PUN 2 for my character/multiplayer setups and I am using the SinglePlayer Rewired Input Manager Prefab (not local Co-Op), but when I poll for a button it gets triggered on all present players not just the local one pressing the button.

    Ive tried checking around for instructions how to set Rewired up for PUN but I can't find anything.

    Please, any help on this would be immensely appreciated.
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    The Ultimate Character Controller integration is a 3rd party integration and I don't support it. I also have no knowledge of PUN 2. It sounds to me like your problem is in whatever you're doing to pipe input to PUN, not Rewired. Rewired has no concept of networking or networked players. If you have set up a single Player in the Rewired Input Manager, all it's doing is providing you input Action values for that Player. What you or other plugins do after that is up to you/them.
     
  20. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    155
    I just wanted to check if no one has brought it up so far, and maybe in what direction I could perhaps look in, anything that could help, its driving me crazy that other people are apparently using Rewired with PUN (as well as the other MP solutions), with no problem and that it is apparently the "defacto, go-to input setup for multiplayer" and yet there doesnt seem to be any hints, let alone tutorials, anywhere for anything regarding it.

    PLEASE, PLEASE, PLEASE, just anything that help me figure this out, Im struggling and no matter what I do or where I look I can't find anything.

    Even just the basic concpets of how to set up Rewired with any type of Online multi-player setup at this point would help, this is one of the many conundrums that has kept me back and it is starting to affect my studios release and the literal well-being of my family at this point.

    Please any help just in the direction of setting Rewired up for any Multiplayer setup at this point would help
     
    Last edited: Aug 18, 2021
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    I already told you, I know nothing about PUN. Your question is about PUN and/or Ultimate Character Controller, not Rewired.

    Rewired is a local input system just like UnityEngine.Input. It is not a networked input system. It has no concept of networking or remote players. There's no reason for it to have any concept of networking. Rewired is running on each machine locally just for that specific user. Rewired doesn't have and should not have any sort of knowledge about any other user but its own local user. It wouldn't make any sense for Rewired to need to know about or manage remote users. For that to be the case, Rewired would have to be a network input server. It's not.

    Rewired provides input for a single machine. Whatever you do with that input is up to you. If your server collects input from all the clients then processes it to move the players around in the world, all the server needs is input from each client. None of those clients need to know anything about input from the other clients.

    I can only guess about PUN because I have no knowledge of it or any other network system, but it makes logical sense that you would simply send the input in some kind of data packet to the server. That is simply taking the output from Rewired, packaging it into some kind of struct, then sending that to the server where it is then processed. That's it. There's absolutely nothing to do on Rewired's end because as far as its concerned, it's input for a single player. There's nothing different about using Rewired for this than UnityEngine.Input or any other input source. Rewired it just the source of input for your local user. That's it.

    Based on your description, it sounds like whatever is in charge of processing input is receiving input from one machine and applying that to all remote players.

    I can't help you because your questions pertain to Ultimate Character Controller and PUN and how they manage input and multiple remote players.
     
  22. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    155
    OK I just assumed this:

    Designed for Multiplayer
    Rewired was made for multiplayer gaming. The player centric nature, the unique and powerful mapping system, and intelligent controller hot-plugging and auto-reassignment make it the ideal input solution for multiplayer games. Of course, it's also great for single player games!

    would actually mean something...

    Also, I am using the Rewired Playmaker Actions for Polling the Input, which is included with Rewired, correct?
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    It does. Local multiplayer. It's very complicated to handle local multiplayer well with all the different devices on all the different platforms that all behave differently.

    Networked multiplayer is a completely different beast. There are many, many, many different implementations of networked multiplayer, each designed for specific needs. Many don't even require input to be sent across the network, instead just sending state data for various objects in the world. Some may require input to be processed both locally and on the server so the server can validate and prevent cheating, etc,. This is a very deep topic because of the variety of designs, and no input system would advertise itself as the universal solution for networked multiplayer.

    PlayMaker Actions are included with Rewired.
     
  24. hyouuu

    hyouuu

    Joined:
    Nov 26, 2020
    Posts:
    8
    Hi @guavaman I'm new to Unity, initially used the Joystick Pack but on Safari if I move 2 pads at the same time 1 would stuck, so I bought Rewired after reading some great reviews. However, I found that on Safari the Rewired buttons & pads are kind of frozen on touch, but works perfectly on Chrome on iOS 14.7.1. I'm using Unity 2021.1 with Rewired 1.1.39.3.

    So for a regular button, tapping on it would make it highlighted but after releasing the touch it keeps highlighted, and the corresponding action is not called. For a touch pad, trying to drag it would make the joystick highlighted but not moving. The more weird thing is, I tried refreshing multiple times and switching back and forth between Chrome and Safari, and on Safari *sometimes* it would work but the majority of times it doesn't. I've also tried to toggle the disable mouse on and off, but neither works.

    Safari must be a relatively common usage environment - do you see anything obvious that I might have set it up wrong? Thanks!

    You can try it here: https://play.unity.com/mg/other/webgl-builds-87587

    P.S: A separate issue on Chrome, is that when I change the drag position of the left stick while keep tapping the right stick to fire, it would pause the fire action until the drag position becomes static, but the top left normal button "Reset" works while dragging the left stick - is it a known limitation of the stick button?
     
    Last edited: Aug 19, 2021
  25. hurleybird

    hurleybird

    Joined:
    Mar 4, 2013
    Posts:
    106
    I was doing axis calibration and looking for a way to reset to defaults, and peering back in the thread it seems that there's no way to do this on a per-axis basis (it would be nice if there were), but you can reset all calibration data in a joystick to hardware defaults with CalibrationMap.Reset().

    This works when the CalibrationMap is changed via CalibrationMap.ImportJsonString(), and ImportXmlString() should presumably work as well.

    However, if you change the CalibrationMap via CalibrationMap.SetAxisData(), those changes persist even after calling CalibrationMap.Reset().
     
  26. liandris

    liandris

    Joined:
    Mar 23, 2021
    Posts:
    8
    Did you try to replicate my issue? I mean, the "Steam virtual device" seem to kick in even if I have Steam's Playstation Configuration Support option disabled. I know it may be unintended behavior by Steam, but a confirmation might help.
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    None of the Touch Controls code knows anything about the platform it is running on. There is nothing special you should or even can do to make anything work differently on WebGL than on any other platform, and there are no differences between Safari and Chrome as far as Touch Control code is concerned. It uses UnityEngine.Input.GetTouches and the standard Unity UI IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler, IDragHandler, IEndDragHandler interfaces to detect input.

    This should work exactly the same on all platforms, so I can only guess that Unity's WebGL touch implementation is bugged or not consistent across platforms/browsers. I can tell by trying this on an iPad in Safari, there are serious issues with touch input and they're not related to Rewired. For example, very often the page will scroll when touches occur over the game window. Sometimes the bottom half of the game window will make the page scroll, while other times less or none of the game window will cause the page to scroll. These factors are completely out of the control of Rewired. Therefore, if WebGL builds aren't working correctly due to Unity and/or the browser, it can't possibly work. I saw some similar issues on Chrome in Android, but it was somewhat usable.

    Again, this code is platform-agnostic. It should work. It works on non-web platforms, therefore, my educated guess is that UnityEngine.Input.GetTouches is not returning the correct data on WebGL. I don't even know the capabilities of touch that are exposed through the browser. Based on behavior I'm seeing, it appears that it has a lot of problems with multi-touch. Touch Ids are probably not being tracked properly. The issue you describe with the Touch Joystick control is not an issue if touch input is working correctly. This behavior does not happen on iOS or Android native builds. These controls require that the underlying touch input track finger ids properly and doesn't suddenly change the finger id because you touch with an additional finger. Something like that is going on here, and it's not something I can fix. The underlying WebGL touch implementation is not working correctly.
     
    Last edited: Aug 20, 2021
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    You are right. The default data is being overwritten when SetAxisData is called. This is a bug.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    I didn't install DS4Win. Testing it would only make sense if I were testing the same version you are using as they appear to make frequent changes based on the release list:
    https://github.com/Ryochan7/DS4Windows/releases

    It's possible this new issue could have been caused by a change to DS4Win, or even possibly a change to Windows itself. My Windows recently updated to 21H1. Windows 11 beta is also out there... I can imagine minor changes to Windows that could easily break either DS4Win or Steam as both depend on a lot of complex, low-level functionality and drivers provided by Windows to do their magic tricks.
     
    Last edited: Aug 20, 2021
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    I also suggest you disable UnityEngine.Input.simulateMouseWithTouches:
    https://docs.unity3d.com/ScriptReference/Input-simulateMouseWithTouches.html
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    I would also point out this from the Unity documentation:
    https://docs.unity3d.com/Manual/webgl-input.html

    Touch support
    While Unity WebGL does not officially support mobile devices yet, Input.touches and related APIs are implemented on browsers and devices with touch support - as well as Input.acceleration.

    ---------

    From my brief experience testing yesterday on Android and iOS, it looks like they still have some work to do.
     
  32. Eskema

    Eskema

    Joined:
    Jun 23, 2010
    Posts:
    317
    Hi there,

    Kind of found an interesting bug and I have no idea where to look at. I'm using linux, and this thing happen in 2 distros (popos and zorinos).
    No controller is detected, neither by unity nor rewired. The controller (xbox one controller) works in steam for games, and according to the systems tools is detected. But nothing in unity.
    I've tried all 3 methods, native, sdl and unity. And the result is the same, 0 controllers connected.

    Btw, the controller is plugged via usb.

    Of course last version of rewired 1.1.39.3 and unity 2020.3.16

    Anyone else had this kind of issue?
     
  33. NikoBay

    NikoBay

    Joined:
    Aug 15, 2018
    Posts:
    35
    Has anyone used Rewired for mobile?
    Last time I checked it costed 2-5ms each frame which was not acceptable for my case even though I had followed everything listed in performance section of document.
    How is it now? Would love some advices to save me hours of building and profiling.
     
  34. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,510
    (1) Are you using one of the Rewired example programs or your own program that is having this issue?

    For example one of the Rewired demos: https://guavaman.com/projects/rewired/docs/ControlMapper.html#overview

    (2) Supported Linux Distros.

    Not familiar with those distros you have mentioned. Have you tried one of the Unity officially supported distros? Based on this thread below and see if it makes a difference.

    https://forum.unity.com/threads/unity-2020-2-unity-linux-distro-support.970059/

    (3) Have you tried the debugging section in Rewired?

    https://guavaman.com/projects/rewired/docs/Troubleshooting.html

    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information
     
  35. Eskema

    Eskema

    Joined:
    Jun 23, 2010
    Posts:
    317
    Thanks for the reply!!!

    Back in unity 2019 I was using popos and everything worked fine. After a project successfully published on Linux for Steam I came back to windows for work reasons.

    Now, I just installed like I said Unity 2020 to discover that nasty bug that affects the editor. Which I have no idea if it's something about the distro or unity.
    Considering that Rewired DOESN'T use Unity at all. I suspect that something changed in the above distros which makes controllers to not respond to the way Rewired ask for them, nor Unity....

    The controller is plugged since the computer boots, like the rest of peripherals plugged via usb...

    The answer to questions
    1- NO, I did not test any demo, I tested my own code that was working perfectly fine on windows. I just formatted windows and installed linux. And such code was used in several games before with no issues. I didn't changed a single line on my code...

    2- NO, I did not tested any of those distros I will never do. Don't get me wrong... I UNDERSTAND that Unity only support those distros, but as my "testing" distros are Ubuntu based they should work. In fact like I said, back in Unity 2019 I published a game in linux using PopOs 20.04. Besides controllers, everything works just fine in both distros. I had no other issues at all.

    3- Yep I looked all the pages before coming here... Like I said, Rewired says "no controllers" on the debug panel of the game object, aka 0 controllers, and if you try unity code to get the controllers (old system), it also said "no controllers".
    You know, string[] names = Input.GetJoystickNames(); it returns 0....

    My controller is an official xbox one controller for pc.
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    The Rewired native Linux code was built for Ubuntu 12.04 and was tested with the following distros:
    https://guavaman.com/projects/rewired/docs/SupportedControllers.html#clarifications

    15 Linux native support has been tested under Ubuntu 12.04 amd64, Ubuntu 14.04 x86/amd64, Ubuntu 15.04 amd64, Ubuntu 17.04 amd64, Mint 17.2 amd64, and SteamOS. Compatibility with other distros is not guranteed or implied.

    The fact that Unity, Rewired, and SDL2 cannot access the device gives a pretty strong indication that either some kind of breaking change was made in these distros, or, more likely, you do not have permissions setup properly for applications to access the HIDRAW device. It is possible these distros default to more security over input. I cannot speak to how Steam manages to make the device work. I do not know how Steam chooses to handle devices, drivers, or permissions at a low level.
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    Nothing has changed. If it wasn't fast enough for you before, it won't be any different now.

    The amount of time the Rewired update takes to process is dependent on many factors not limited to but including:
    1. CPU speed.
    2. The number of Players.
    3. The number of currently enabled Controller Maps and bindings.
    4. The number of Actions bound to those Controller Maps.
    5. Any user code executed in Rewired callbacks (event-based input).
    6. The build type (debug, release, etc.)
    7. Unity profiler settings (deep profile, etc.)

    2-5ms would indicate either a very slow, old CPU, a ton of Players, Actions, and Controller Maps, or all of the above. I recall seeing numbers like that when testing back in the day on a Galaxy S3 phone from 2013. On a modern desktop PC, my standard test configuration with 7 players executes in 0.08 to 0.15 ms. The same test just performed on a Galaxy S20 FE phone executes in 0.35 - 0.42 ms. The Android test was done in a release builds without using Unity's profiler. The Windows test was done in the Unity editor.
     
  38. NikoBay

    NikoBay

    Joined:
    Aug 15, 2018
    Posts:
    35
    Tks for the info.
    As I recalled, I tested on iPhone6s with deep profile on, scene basically clean. My aim is to make a game that runs smoothly on a phone like i6s.
    This is a very good asset but unfortunately I don't think this can be fixed with mere few hours and at current state I can't afford that trial and error. Maybe in the future with more resource or with a console version, I will try again.
    Tks again and have a nice day.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    Deep Profile massively increases CPU usage reported by the profiler because of a huge amount of reflection going on. Deep Profile can increase CPU usage by 10x on some platforms. In addition, to enable it, you have to be using a debug build. Both of these things are massively inflating the perceived CPU usage. Real CPU usage in a release build isn't going to be anywhere close to what Deep Profile reports.
     
    NikoBay likes this.
  40. kode54

    kode54

    Joined:
    Jun 14, 2021
    Posts:
    2
    Asking as a user of Konami's Frogger in Toy Town on Apple Arcade, it appears as if the Xbox Series X Controller does not work with macOS. I haven't tested on iPad. Is this supported by a recent version of Rewired, and if so, should I bug Konami about this? I should probably also bug them for absolutely not supporting custom mapped controls whatsoever.
     
  41. Eskema

    Eskema

    Joined:
    Jun 23, 2010
    Posts:
    317
    Thanks a lot, that HIDRAW is a good starting point and the permissions point as well :)

    While I'm an experienced coder, I'm a noob when it comes to linux, so I have no idea where to look at.... Thus my questions asking for tips :)
     
  42. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    121
    hey, simple question: is it possible to show the Joystick information in the editor inspector?
    like when i do public Rewired.Joystick[] _joystick; or public Rewired.Joystick joy; i cant see the values.

    thanks!
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    No. Rewired objects are not serialzable and cannot be shown in the inspector like that.

    If you are trying to see the values of objects at runtime, use Debug Information:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    I don't have any information about Frogger in Toy Town and I don't even know if they use Rewired. I don't provide support for games made with Rewired, only for developers who are using Rewired to make their games.

    The Xbox Series X Controller should work via Bluetooth on all versions of Rewired on MacOS. It will not work via USB unless a 3rd party Xbox driver is installed. Even testing with a preliminary implementation of GCController framework, the controller cannot be detected except when connected via Bluetooth.

    Rewired does not use GCController framework. It uses I/O Kit, which is an older HID framework that supports more device types than GCController. GCController is basically XInput for Apple platforms. IO Kit does not have universal support of GCController-controlled gamepads. I have been working on GCController support for MacOS for a very long time but there is no ETA on any change to this.
     
    Last edited: Aug 24, 2021
  45. damonwall

    damonwall

    Joined:
    Jan 22, 2013
    Posts:
    14
    Hello @guavaman first of all thank you for this amazing plugin, saved me tons of time! Good job making this =)

    So, a question. On Windows my game works perfectly fine.
    However, now I'm porting to Android - and on Android Rewired doesn't see my bluetooth gamepad. At all - ReInput says that joystickCount == 0 and Joysticks collection is empty. I'm trying to understand what am I doing wrong here...
    Is there a chance to find out why my controller isn't working on Android?
    I've tried my ipega PG-9023s (which is not on the list of pre-defined gamepads) and Power A MOGA Pocket (which is also not on the list) - in both cases gamepad wasn't detected at all.
    Is there a chance that I might be doing something wrong on the Unity side?

    oh sorry forgot to mention
    I'm using Unity 2018.2.5f1 and ReWired 1.1.37.0.U2018
     
    Last edited: Aug 24, 2021
  46. HL-JoshCooke

    HL-JoshCooke

    Joined:
    Apr 30, 2019
    Posts:
    8
    Surprised to see only one mention of the Steam Deck in this thread.

    Is that because it should just work out of the box with games using Rewired?

    Valve recommend Steam Input API but does anyone know if that is essential?
     
  47. damonwall

    damonwall

    Joined:
    Jan 22, 2013
    Posts:
    14
    @guavaman a followup to my previous post #7495
    I've connected ps4 dualshock, and it worked perfectly okay!
    Is there a way to make non-standard gamepads, such as moga and ipega I've mentioned, to work? I'm totally willing to do a custom control mapping screen, it's just they're not even getting into ReWired system, so nothing to remap so far
    Also my friend has tried "Google Gamepad for Nexus Player", which didn't work either.

    iPega works fine when I use it in PC editor - it's being detected as Amazon Fire Controller by ReWired.
     
    Last edited: Aug 24, 2021
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    If ReInput.controllers.joystickCount is 0, the controller is not being detected by Unity and exposed through Input.GetJoystickNames. There is no way to fix this because the joystick simply is not present. This has nothing to do with mapping. Adding a custom control remapping system will not solve this issue. Ensure all the correct permissions are requested by the application.

    Rewired on Android depends on UnityEngine.Input for all controller and input information:
    https://guavaman.com/projects/rewired/docs/Overview.html#tested-platforms
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    4,860
    Steam Deck has not been tested. I don't know how it works or whether or not it works with Rewired. This is not listed as a supported or tested platform on the website or in the documentation.

    https://guavaman.com/projects/rewired/docs/Overview.html#tested-platforms
     
  50. damonwall

    damonwall

    Joined:
    Jan 22, 2013
    Posts:
    14
    That's what I was afraid of :-( Thanks!
     
unityunity