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:
    5,632
    That line does compile and was just specifically added for Unity 2021.2.0f1. This is a required fix for Unity's change to start retrieving Raw Input values using buffered function calls. You can read the whole history of this change here:
    https://forum.unity.com/threads/windows-mouse-raw-input-mouse-handling-broken-in-rewired.1172786/

    If it's not compiling then there's something wrong with your project. An ASMDEF file was added specifically to compile this script in its own assembly due to the fact that the function exposed by Unity is an unsafe function using native pointers and a normal script in the project cannot compile unsafe code without the user changing the project to allow it to compile unsafe code. If you have added your own ASMDEF files to Rewired's folder structure, they could easily interfere.

    Remming out that line guarantees Unity's keyboard and mouse input will not function when Rewired is running.

    The line will not compile in any 2021.2 beta prior to b16. It has been tested with 2021.2.0f1 and works.
     
    sebas77 likes this.
  2. ObsidianSpire

    ObsidianSpire

    Joined:
    Sep 13, 2013
    Posts:
    48
    Hi, what would the easiest way to handle simultaneous opposite cardinal directions be? Basically, we want to prioritize the last input made or either one of the directions if both were pressed on the same frame instead of the player being able to hold both directions simultaneously. Currently, the player goes nowhere as the GetAxisRaw call returns a 0 if both A and D are held.
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    If you are asking, can you customize the used Actions are calculated from the constituent inputs contributing to that Action, no. For keyboard keys, the Input Behavior digital axis settings apply, if enabled, which may change some behavior:
    https://guavaman.com/projects/rewired/docs/InputBehaviors.html

    See Digital Axis Snap and Digital Axis Instant Reverse:
    https://guavaman.com/projects/rewired/docs/RewiredEditor.html#InputBehaviors

    Other than digital axis settings which only apply to buttons/keys, if you want to do something like that, you'll have to use two separate Actions.
     
  4. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    I am running Unity 2017.4.40. After updating and importing Rewired from the Asset Store window in the Editor, the Rewired version was only updated to 1.1.39.3.U2017, not the latest rewired version.

    Is this expected to occur?
    Thanks.
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    The Unity Asset Store has dropped support for versions of Unity prior to 2018.4.0. It is no longer possible for me to upload updates to Rewired for Unity 4, 5, 2017, or 2018.0. The only way you can get a Rewired update for a version of Unity prior to 2018.4.0 is to download it from my website. Contact me on the support form on the website if you want access.

    https://guavaman.com/rewired#support
     
    KarlKarl2000 likes this.
  6. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    396
    Hi, few questions.

    Is it too much work to scrap your tool just for pc gamepads, keyboard + mouse? I just don't want unnecessary codes, libs etc.

    Still confused which one should I go with? As I told the required hardware above and I won't have too many complex inputs (for single player). And I'll use them just for 2-3 different control schemes (on foot, on vehicle etc). So I heard new input costs a bit more performance than the old. Used it a few times but didn't stress tested. How about rewired, is that would be overkill? Which way would be better in terms of performance for my humble needs?
     
    Last edited: Nov 16, 2021
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    You pretty much are describing the entire reason Rewired was created in the first place. Unless you just want to support XInput gamepads only, managing controller input is an enormous monster to reign in and the reason Rewired was created. There is nothing event remotely simple or straightforward about robustly supporting controllers on desktop platforms.

    I can't give you any advice on whether you should choose Rewired or Unity's new input system. I have not thoroughly evaluated their system and can't make comments about how well it works or its performance. There are plenty of threads on the forums of people discussing the pros/cons of each system.

    I suggest you get the trial version and evaluate it for yourself:
    https://guavaman.com/rewired/trial
     
  8. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    104
    I just played Forza Horizon 5, and was amazed when I learned my Xbox One S Wireless controller had trigger haptics. I had never felt that before on PC.

    Is there anyway to get access to the trigger motors on PC through XInput?

    joystick.vibrationMotorCount only returns 2 :( This is probably more of a XInput issue, now that I felt it on PC, and Forza is somehow making this Black Magic happen, I want to play with it too.
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No. XInput was released somewhere around 2004 and has largely remained unchanged since. It only supports features of the Xbox 360 Controller. The only ways to access the other 2 motors on the Xbox One controller are to use either the Windows UWP Windows.Gaming.Input API or the newer GameCore GameInput API. While the UWP Windows.Gaming.Input API is available to desktop applications on Windows 10, Rewired does not support it as an input source on Windows Standalone for a number of reasons (one of which is Steam - read this). Rewired does support the extra motors in UWP builds as well as in all Xbox platform builds.

    https://guavaman.com/projects/rewired/docs/FAQ.html#force-feedback
     
    Last edited: Nov 20, 2021
    Justin-Wasilenko likes this.
  10. SquareEyesTaco

    SquareEyesTaco

    Joined:
    Mar 25, 2013
    Posts:
    28
    Hello , new here, i have a thrustmaster red legend edition - i dont see it on the list.dont suppose it still can work tho? The wheel actually already work but the pedals do not. With rewired could i get the pedals to work?
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    All controllers that are not on the list are supported through the Unknown Controller:
    https://guavaman.com/projects/rewired/docs/SupportedControllers.html#controllers-without-definitions

    You must map the devices at runtime to use them.

    "Doesn't work" is a very vague and could describe any problem anywhere in the entire input stack, from the bottom controller level to the top Player-Action level.

    See these topics to drill down and find out what exactly isn't working:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#controller-doesnt-work
    https://guavaman.com/projects/rewir...l#debug-information-diagnosing-input-problems
     
  12. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    In addition to what @guavaman wrote how are your pedals setup? You can have them set as a split axis or independent which is the default. It works better with the pedals as independent for mapping purposes.

    I believe this is the same documentation as your wheel (correct?)

    https://ts.thrustmaster.com/downloa...edlegend/ferrari_rwheel_red_legend_manual.pdf
     
  13. Smack332

    Smack332

    Joined:
    Nov 5, 2018
    Posts:
    9
    Thanks, that's great news. So I would need to upgrade my project to 2021.2 for this to work?
     
  14. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    https://assetstore.unity.com/packages/tools/utilities/rewired-21676#releases

    Based on the Rewired 1.1.41.1 release notes ... you need Unity 2021.2+ and Rewired 1.1.41.1

    1.1.41.1: Changes: - Added warning to Rewired Input Manager editor to warn users to set Joystick Auto Assignment Max Joysticks Per Player to 100 if a single-player game because of how many developers ignore this setting are left with games that cannot be controlled if a virtual controller or another controller is connected to the system that takes priority other than the one the user is trying to use. Bug Fixes: - Unity 2021.2+, Windows Standalone, Raw Input, Direct Input w/ Native Mouse/Keyboard Handling: Fixed bug in new Raw Input event forwarding that could cause a multiple of the number of events to be forwarded to Unity if the number of events that were received during a frame exceeded 100. This could occur after execution was resumed from a breakpoint in a debugger due to mouse and keyboard input.
     
    Smack332 and guavaman like this.
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Yes and @longroadhwy is correct.
     
    Smack332 likes this.
  16. hedgefield

    hedgefield

    Joined:
    Jan 1, 2014
    Posts:
    39
    Hey there, long time happy customer of Rewired here. Today imported Rewired 1.1.41.1.U2021 into a project on Unity 2021.1.28 and it's acting a bit odd. When I launch the Rewired editor window, make a bunch of changes, then close the window, it will only remember the first thing I changed. So say I added three new actions, named them and changed their type, then I close the window. Next time I open the window only the first action will still be there, and it will still be called Action0. This goes for any operation I do in any section of the Rewired editor.

    It might well be a Unity bug, because Rewired 1.1.40.0 in another project does the same, and it never did that before I upgraded from Unity 2020 LTS. I tried upgrading the project to 2021.2 to see if that would fix it, but it didn't, so if it's something that Unity broke, it's still broken in the latest version.

    This renders Rewired pretty much unusable for me, so I hope a solution can be found?
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    There is no explanation possible other than new under the hood changes to Unity's editor prefab editing system which is undocumented and was painstakingly figured out through trial and error to make the editor work with all their new prefab workflow functionality added years ago in Unity 2018. If this is has suddenly changed, the house of cards will undoubtedly collapse.

    Ever since their new prefab workflow system, I have been considering removing entirely the "old way" of Using Rewired -- namely, having the ability to edit the Rewired Editor settings without explicitly opening the prefab in Unity's prefab editor in order to edit it. Allowing you to keep the editor open and have it load the data based on whatever Rewired Input Manager game object or prefab was clicked. I went to great efforts to make it "just work" as before their change by doing all sorts of management of opening, saving, and closing the prefab state automatically and detecting all sorts of edge cases like pressing Play without having saved the data, etc.

    If I were to do all this over again with 20/20 hindsight knowing how Unity's prefab system would be changing years after I designed the system, I would have made the editor data be saved in a ScriptableObject, not in a MonoBehavior. That would have avoided all the prefab nonsense.

    It sounds to me like it's time to rip all of this out and just force users to explicitly open the prefab in order to be able to edit the data.
     
    Last edited: Nov 24, 2021
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Yep. I can confirm this is now broken in Unity 2021.2.0f1. Editing the prefab instance without first explicitly "opening" the instance in the temporary scene by pressing "Open" in the prefab inspector will result in only the first modification to the prefab "sticking" after launching the editor. The fires never stop...
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    I have found workarounds that appear to make it work again.
     
  20. hedgefield

    hedgefield

    Joined:
    Jan 1, 2014
    Posts:
    39
    Oh wow it's crazy that they make you jump through all these hoops just to keep your asset working as before. Thank you for investigating, and I am glad to hear that I can for the time being work around it by opening the prefab, that's a negligible inconvenience compared to otherwise not being able to continue working. Thanks!
     
    guavaman likes this.
  21. unlikelysurvival

    unlikelysurvival

    Joined:
    Aug 17, 2017
    Posts:
    5
    Is it in your plans to eventually support the new system? We're getting ready to start our next big project, love using Rewired, but don't want to get 12 months down the road when Unity says their discontinuing the old system and have to change over anyways. Even though it's not there today if you plan to keep Rewired around and working with the new system eventually, we'd love to stick with the product.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No plans. That would take an enormous amount of time to remap all those devices on all those platforms and input sources. At last count Rewired had over 1,000 manually-created controller definitions and variants (probably well more than that) for all the platforms and input sources it supports. Much more likely is that Rewired would be getting more native implementations to cover these platforms that rely on Unity for one or more types of input support rather than making Unity's new input system the official input source for Rewired.

    Unity has made statements in the past that they do not plan on removing the legacy system, and that it has been revamped to use the new input system backend.
     
    unlikelysurvival likes this.
  23. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Oh, that's new to me.
    Does that mean having both systems in project is actually "better" in the sense that both are going to be using the same backend? Or that the legacy system already uses the deeper parts of the "new" input system, and having only the legacy one in a project is enough to benefit from this?

    I never actually enabled the new input system, haha. When I do work for a new client, I just get them to buy enough Rewired licenses and call it a day. Input handling is a lot more insanity than most people would think at first glance.
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    I don't recall if I read that in the forums or if someone told me that directly. It was a long time ago, so it may be wrong. But at the time I heard it, that's what I understood. That the old input system would be retained, having the source of input for it replaced with the new input system backend. I was under the impression that they had already done this, but again, I may be wrong. What I am sure of is I have not heard any plans announced to remove the legacy input API.

    I like your approach! :D
     
    unlikelysurvival likes this.
  25. CHOO5D

    CHOO5D

    Joined:
    Dec 24, 2016
    Posts:
    55
    Hi, is there a way to test dualshock, dualsense, and switch controls without having those controllers?
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No. You have to have the device to test it.
     
  27. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    192
    You make it sound so easy! Open XR is the only way to do VR in Unity these days and so having some support for it from Rewired out of the box seems wise.

    Has anyone here written a Custom Controller that works with Open XR?
     
  28. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    77
    It looks like, when using the Rewired Initializer on Unity 2021.2.3f1, the InputManager that it instantiates gets destroyed when changing scenes with LoadSceneAsync.
    DontDestroyOnLoad is set to true on the Inputmanager prefab.
    However, when starting the scene (any scene) the inputmanager does not get placed into the DDOL additive-scene (all my other singletons do).

    If I manually place the inputmanager into the DontDestroyOnLoad, it persists, and does not get destroyed.
    So I fixed it for now by adding a script that does this, and calls DDOL on start on the InputManager.

    Are you reflecting something weird, could there be a possible cause where I have my own script, also called InputManager (in a different namespace)?
    If not, why doesn't the inputmanager go to the DDOL scene when I press play? Is this expected behaviour?
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    If that's true, Unity has broken "Don't Destroy on Load" in some way. It sound like they broke a whole lot of stuff in the 2021.2.0 update. This is at least the 3rd thing they broke/change that breaks Rewired if true.

    There is nothing whatsoever weird going on with Rewired Initializer. The class is 66 lines of code and does nothing but check if another Input Manager exists before calling Object.Instantiate.

    There is only one possible vector that could explain it.
    • The initializer instantiates the Rewired GameObject and then parents it to its own parent.
    • Because Awake runs immediately upon instantiation, the Rewired Input Manager instance will call "Don't Destroy On Load" on its root parent transform before the initializer can parent it.
    • If the Rewired initializer has a parent GameObject, the Rewired Input Manager would then get parented, and presumably the "Don't Destroy On Load" flag would be lost now where it wasn't before?
    The only way I can see what you're describing as being possible without some other completely unrelated explanation is that you have the Rewired Initializer nested inside some other object instead of being the root object.
     
  30. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    77
    I was/am doing that actually, it's nested under another gameobject. But afaik when calling DontDestroyOnLoad(Object) it does not matter how it is parented in the hierarchy, since it normally gets immediately placed inside of the DontDestroyOnLoad scene. If Rewired InputManager is calling DontDestroyOnLoad on itself on start/awake, it is somehow not happening since we have a lot of other scripts that work this way and they all pop into the DontDestroyOnLoad scene on start.

    But you are definitely right that Unity's updates have been breaking things, since this all worked for a long time and we did upgrade to latest 2021 recently.
     
  31. Joshdbb

    Joshdbb

    Joined:
    Oct 28, 2014
    Posts:
    50
    What are the options for supporting more than 4 controllers? I know that xinput has a max of 4 controllers but I'm struggling to find any information about the max controllers for other input sources.
     
  32. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    I don't document all the features and limitations of each platform and input source. The only reason there would ever be any kind of controller count limit is if the platform/input source imposes it. Rewired does not impose any limits of its own.

    Console platforms all have limits. Desktop platforms may or may not depending on the chosen input API. Unity also has its own limits if using UnityEngine.Input for the input source.

    On Windows:
    XInput is limited to 4.
    Direct Input has no known limit.
    Raw Input has no known limit.
    SDL2 may or may not have a limit depending on whether XInput is enabled in SDL2.
    Unity has a limit of 11 I believe, but that value may be less in older versions of Unity.
     
    Last edited: Dec 2, 2021
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Rewired's code was changed in 1.0.0.111 on 1/20/2017 due to a change in Unity at that time:

    - Rewired Input Manager "Don't Destroy on Load" is now applied to root Game Object to avoid warnings in log if Rewired Input Manager is parented under another Game Object.

    Unity made the Object.DontDestroyOnLoad function log a warning if called on a non-root object. I don't know if it still logs that warning, but Rewired has worked like this for the last 5 years because of that warning.

    In this case:
    1. The Rewired Input Manager is instantiated.
    2. Newly instantiated objects have no parent.
    3. Awake runs on the newly instantiated Rewired Input Manager.
    4. DontDestroyOnLoad is called from Awake.
    5. The Rewired Initializer parents the Rewired Input Manager to its parent.
    6. The Rewired Initializer deletes itself.
    You can see at no point is DontDestroyOnLoad called on the GameObject after it is parented to the parent of the Rewired Initializer. Since the Rewired Input Manager is itself responsible for the DontDestroyOnLoad setting and it executes in Awake, the object cannot be parented before Awake runs. This is the reason for the new problem. The responsibility of setting DontDestroyOnLoad now has to be on the Rewired Initializer.

    Before now, Unity must have automatically made the entire GameObject hierarchy inherit the DontDestroyOnLoad flag when parenting an object that already had the flag set into the hierarchy. That is no longer being done clearly.
     
  35. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    Can you please provide an API for Rewired_DirectInput.dll ? I want to send custom force feedback messages with DirectInput. If your DirectInput.dll already has force feedback functionality there is no need to add my own to Unity.
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Rewired_DirectInput.dll is for internal use and was only created because when Unity implemented IL2CPP they broke the SharpDX library which used certain IL code commands that no longer worked. I had to make a bindings library to get around that problem. It only contains bindings to the functions I need for Rewired, not the entire Direct Input API.
     
    kopanz likes this.
  37. gstows

    gstows

    Joined:
    Jun 30, 2014
    Posts:
    1
    Question:

    what defines "active controller" in AddLastActiveControllerChangedDelegate? I assume it's "whichever controller sent the last event", but which events count? If a controller is constantly sending, say, gyro axis information even though no movement has been done, will it constantly be calling itself "last active"?
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    https://guavaman.com/projects/rewired/docs/HowTos.html#last-used-controller

    There are 2 versions that work very differently from each other:
    • Controller - Based on controller elements.
    • Player - Based on Action values mapped to controller elements.
    Gyro is not considered a Controller Element and is only exposed through a Controller Extension for a specific controller. There is no generalized IMU handling in Rewired. IMUs are (almost) always exposed through the Controller Extension. The only exception is the Apple Remote which has the IMU exposed as axes (looking back, this was a mistake to do, but it was implemented before the Controller Extension system even existed.) The IMU axes on the Apple Remote are ignored in detecting the last active controller.

    Gyro is not mappable through the Action system and has no bearing on the Player version.

    Last Active Controller is based on the last time any element on that controller (or any Action mapped to that Controller in the Player version) changed. You can implement your own easily by using the functions exposed in the Controller that report time/duration of various element activity.
     
  39. little_box

    little_box

    Joined:
    Aug 22, 2017
    Posts:
    28
    Control Mapper code design really awful. I just wanted to follow example to design my own Control Mapper. But the Control Mapper itself is complex and difficult to use and modify.
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    If you don't like it, don't use it and write your own.

    Control Mapper was not designed for you to be using as the basis of your own custom-coded system. It is a drop-in-and-use control remapping implementation to be used as-is and customized by changing inspector options and setting up your own theme options. Other examples are provided for the purpose of learning how to write your own system.
     
    Last edited: Dec 8, 2021
  41. chaos456

    chaos456

    Joined:
    Aug 22, 2013
    Posts:
    10
    Hi! I got a few issues, I apologize in advance if this has been answered/documented before.

    Controllers work properly on Rewired (I don't have many to test if everything works, x360 and a Generic USB Controller's all I have). Once I released a small demo, there were a few reports about controller input mapping being off.

    My guess is the controllers being reported faulty are falling back onto the Unknown Controller or Gamepad Template maps. But this has been reported to happen on controllers that in theory should work as they're mapped properly in the Joystick Maps category, mostly Xbox (360, One, Series S/X) and PlayStation (PS4, DualSense) controllers are the ones giving issues.

    Not all of the reports I've gotten have been confirmed but a good handful of them happen with Wireless mode specifically, once they play with their controllers on Wired mode, the input mapping falls back to the proper place. Though there have also been a handful of cases where no matter what mode their controller is in, it still falls back to the 2 aforementioned templates. (Worth noting the people who help me beta test have tested the game with controllers that apparently give errors and they worked fine, but they could've been in Wired mode)

    I'm mostly the one who works on the entire project so it becomes hard to troubleshoot these reports. If there's any way to fix these problems I'd greatly appreciate it.

    Hopefully not taking anyone's time away if this is a dumb oversight on my side, I will contribute any info about my settings if needed. Thanks for reading and have a good day!
     
  42. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    1. What platform(s) are you talking about? This is extremely important information.
    2. If Windows, is Use XInput enabled?
    3. Do these users have any 3rd party drivers installed (DS4 specifically. DS4Win is known to cause a lot of problems with Steam.)
    4. Is Steam involved?
    5. How is Steam Controller Configuration set up for your game (backend and the user's settings matter.)
    https://guavaman.com/projects/rewired/docs/SpecialPlatformSupport.html#steam

    Drivers, firmware, 3rd party mapping tools, platforms like Steam that take over input, etc., can all affect a device's identifying information.

    Have you provided your users a way to map their controls as advised in the Best Practices documentation?

    FYI, Gamepad Template is not a fallback. It cannot be used by unrecognized devices. This is explained in the Controller Template documentation. The only fallback that exists in Rewired is the Unknown Controller.

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

    The Gamepad Template allows you to make a map which will cover all of the gamepads listed here.

    NOTE: Do not be confused and assume that the Gamepad Template will apply to and work with every gamepad in existence. The Template only applies to and works with recognized gamepads that have controller definitions. There is no possible way to create a system that can automatically recognize and map all gamepads, steering wheels, flight controllers, or any other type of device because the required information to do this simply does not exist in the USB or HID data provided by the device. Only devices that have controller definitions can work with the Template system.
     
    Last edited: Dec 9, 2021
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
  45. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Weird I was thinking the re-download button is supposed to prevent this from happening i guess not, Unity Things

    Anyhow I deleted the asset,re-downloaded and still get those errors?
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    I misread the errors. I had previously seen a posting of these same errors with the additional errors caused by Unity installing the wrong version of Rewired and I thought this was the same set of errors. This is a Unity error and cannot be fixed. It's an error in their API updater. It is happening because Rewired is making a call to Texture2D.Resize somewhere in its code and the API updater chokes on this function. This is being discussed in this thread:

    https://forum.unity.com/threads/libraries-that-fail-to-compile-on-2021-2.1144946

    The current status is the error has been fixed but it hasn't made it into the Unity release branch yet.
     
    zKici likes this.
  47. AHAKuo

    AHAKuo

    Joined:
    Apr 15, 2019
    Posts:
    5
    Hello there! I had a question regarding the input mapper.

    I have set it up for my custom remapping UI, and everything is working fine. However, I want to prevent mapping using some specific buttons like (ESC, or Pause Button on a joystick). How do I make the input mapper ignore those inputs so they cannot be mapped?

    I have protected UI and system controls by setting up specific categories for them, and they do not unmap so that's fine. But their buttons (esc, and the like...) are still available to map on another category like Gameplay. This would make the same button trigger multiple actions.

    That's why I want to prevent those buttons from mapping.

    Perhaps this question was asked before, but I could not find it.

    Thank you!
     
  48. notagame

    notagame

    Joined:
    Sep 17, 2017
    Posts:
    17
    Hi, I have a question regarding modifier keys.

    If I setup an action that acts when I press a single key, like "1" and I also have the standard sprint+walk action "Shift+WASD", then if I press "Shift+1", the action I mapped for "1" is NOT triggered. That means, when I sprint with "Shift+W" and at the same time press "1", the action for "1" also is NOT triggered.

    It seems like modifier keys, if pressed, only enable actions that act on modifier keys. Does this mean I have to setup any combination of modifier keys to map to "1", so "1", "Shift+1", "Ctrl+1", for this to work, or is there another way to tell Rewired to always trigger the action I mapped to with "1", regardless of which modifier is pressed at the same time?

    I gather that this is a very common issue, because in any FPS (even though I am not developing an FPS), you sprint with Shift+WASD, so you couldn't trigger any other action at the same time, like "R" for Reload, unless you also mapped "Shift+R" to the Reload. This seems a bit cumbersome.

    Thanks!
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    You haven't set up those protected categories to be conflict checked against the other unprotected categories. Conflict checking only checks for conflicts with the categories you have defined for it to check against. If you set up protected controls but do not set those categories to be conflict checked against the other category you're mapping, no conflict will be generated. Conflict checking is configurable independently each way, which means Protected Category -> Non Protected Category check is different that Non-Protected Category -> Protected Category check. If you are rebinding Non-Protected Category, it must be set up to check for conflicts against Protected Category.

    https://guavaman.com/projects/rewired/docs/HowTos.html#conflict-checking
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    What you're describing isn't how modifier keys work, should not be happening, and I cannot reproduce it. I have it set up exactly as you describe and there are no issues:

    W = Move Vertical +
    S = Move Vertical -
    A = Move Horizontal -
    D = Move Horizontal +
    Shift + W = Run Vertical +
    Shift + S = Run Vertical -
    Shift + A = Run Horizontal -
    Shift + D = Run Horizontal +
    1 = Test

    No combination of holding shift or any other modifier key affects the return value of Test. It always works when pressed.

    Having a modifier key set up will not affect in any way the ability of other Actions to be triggered for keys that are not part of a modifier key binding. The only way what you're describing could happen would be if you have assigned a modifier key binding which binds Shift + 1 to some Action and you are not monitoring the value of that Action.

    The only other explanation could be key jamming:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#key-jamming

    Regardless, I would recommend you do not use modifier key bindings for setting up sprint functionality. That's brittle and requires the user to rebind all their movement keys for Walk and Run individually.

    See this for a better solution:
    https://guavaman.com/projects/rewired/docs/HowTos.html#button-combos
     
    Last edited: Dec 12, 2021