Search Unity

Rewired - Advanced Input for Unity

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

  1. Shpinxis

    Shpinxis

    Joined:
    Dec 4, 2014
    Posts:
    6
    Tried looking for an answer on my own first but couldn't find a satisfying answer.

    Is there a built in way to have "long press" and repeat delay for axis (like on the joystick). Just like button presses where there is a delay and then it goes into a hold state? To be clear, if you were to press the axis/joystick up, it sends one signal of going up and then after a delay sends a holding up signal?

    Thank you.
     
  2. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @guavaman

    It so cool to see more flight controllers being developed.

    Honeycomb is really doing a great job on reasonably priced flight controllers. This new Bravo Throttle is very nice (love the trim wheel) and considering how many different things you had to purchase from Saitek to get close to this. Looking forward to see what their Charlie Rudder pedals in the distant future too.

    (thanks to @Steve-Tack for pointing me to this video).

    Honeycomb BRAVO Throttle Quadrant Unboxing | FIRST LOOK & REVIEW with Flight Simulator 2020

     
    guavaman likes this.
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    No.
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Impressive unit there, especially the customizability. Thanks for sharing!
     
  5. Dimonasdf

    Dimonasdf

    Joined:
    Aug 16, 2018
    Posts:
    5
    Hello!
    We're experiencing an issue with D-pad of Xbox One controller. Most of our UI input works through Rewired Standalone Component, where Horizontal and Vertical Actions are set to UIHorizontal and UIVertical - axis-type actions in Rewired Editor. In Joystic Maps Left Stick X and Y are set respectively, as well as are all 4 D-pad buttons for each axis contribution.
    But in some menus there is a unique behavior with subscription. For example, there is a map menu, where we want the stick to scroll map and d-pad to navigate legend list. There are separate MoveMapVertical and MoveMapHorizontal axis-type actions, which are set to Left Stick, and 4 button-type actions for d-pad. They are all being subscribed on the opening of the map with AddInputEventDelegate.
    This scheme works on keyboard and PS4 controller, but not on XBOne (as well as some XEOX gamepad we have laying around (SL-6556-BK to be exact)) under exact same conditions. Map scroll with stick works okay, but when you press d-pad buttons - nothing happens, callback is not reached, though it reports subscribed in event system, and if you will try keyboard arrows without leaving menu - they will work.
    We found out, that if we check Disable Native Input in Rewired Editor, the d-pad is going to work as intended. But we lose all vibrations (SetVibration method is called, but nothing happens), which is not an option, as you might guess.
    We've found this issue on known issues list - https://guavaman.com/projects/rewir...l#windows-10-fallback-xbox-one-mapping-issues, which led us to exploring Native Input check, but there are some differences - we are using Windows version 2004, and I've also tried this on 20H2, the problem persists. Also, actions are not cross-mapped anywhere, triggers and bumpers do not trigger callbacks, they are just lost.
    We'd greatly appreciate any ideas on resolving this problem, thanks in advance!
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    #1) Is Use XInput enabled.
    #2) Are you using Steam.
    #3) Go through this checklist.
    #4) Don't disable Native input. That is never the solution to problems.

    This almost certainly has nothing to do with UI. The Controller Buttons must be returning True, then the Action value must be returning True for it to work. There are a total of 4 layers that go into giving you the final Action value. That check list will take you through each one of them to see at which level it is failing.

    There are no issues with Xbox One controller D-Pads.

    The only known issue with this is a Steam issue, not a Rewired issue, when you have Use XInput disabled and are using Raw Input for input. Steam incorrectly structures its Input Report packets causing the D-Pad and the Menu/Option buttons to fail. Steam has fixed this in the latest beta client.
     
    Last edited: Nov 12, 2020
  7. Dimonasdf

    Dimonasdf

    Joined:
    Aug 16, 2018
    Posts:
    5
    1. Yes, XInput is enabled. 2. No, we were not making any special Steam-related integrations as of yet. 4. Okay.
    I've found some interesting info in Debug Information. These are action maps:

    And this is how they are being mapped on ps4 controller:

    And XB1 controller:


    Notice, how on Xbox controller all legend navigation actions (UIAlternatives) are mapped to positive Left Stick X.
    How can this be resolved?

    Edit: We don't have any unique joystick settings in Joystick Maps.
     
    Last edited: Nov 13, 2020
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    What you're showing me should be impossible. For that to happen would mean that the Gamepad Template is completely broken and not working at all. Nothing has changed with the Gamepad Template in many years and I have never before seen anything like this. Left Stick X is showing up as a Button Map??? That makes no sense whatsoever and should not be possible by any code path I can imagine. There's something seriously wrong with your data. It could be some kind of data corruption in the controller definitions or in the Rewired Input Manager. Did you upgrade Unity recently? Did you modify any controller definitions or the gamepad template definition? Did some kind of bad merge happen in version control? It's like all the element ids and Action ids are wrong. I suggest doing a clean install of Rewired:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#clean-reinstall

    Are you loading saved user data? If so, clear it:
    https://guavaman.com/projects/rewired/docs/UserDataStore.html#saved-xml-not-synced

    Either send me the prefab you are using or export all the data to JSON from the Tools page and send it to me.

    I am also not seeing any Action names shown in debug information for the bindings and just a (+) which is also not correct and inexplicable.

    I also suggest you install the latest version of Rewired.
     
    Last edited: Nov 13, 2020
  9. elder0010

    elder0010

    Joined:
    Oct 31, 2015
    Posts:
    14
    Hello!
    I need to update Rewired from 1.1.37.0.U2018 to the current version for Unity 2020.
    I installed it from Unity 2018 and then I upgraded my project to Unity2020. The problem is that if I try to install again from the Package manager, it keeps downloading the U2018 branch.
    I tried also with a fresh project on unity 2020, same result.

    Here is the console warning:
    Code (CSharp):
    1.  
    2. Rewired: The version of Rewired installed (1.1.37.0.U2018) was not designed for Unity 2020. Please install Rewired for Unity 2020.
    3.  
    4. This warning does not mean that Rewired will not function, but it may not function optimally.
    5.  
    6. Some different major versions of Unity download Asset Store assets to the same folder location on disk, so if you download an asset in one version of the Unity editor, then open another version of the Unity editor and install the asset without re-downloading it, the wrong asset version will be installed. To fix this, manually re-download Rewired in the Unity Asset Store panel in this version of the Unity Editor, then install it.
    7.  
    8. If you are using a beta version of a new major version of Unity, you will have to wait until the release of the final version before a compatible version of Rewired can be uploaded to the Asset Store. When the new version is ready, it will be available through the Unity Asset Store for download as usual.
    9.  
     
  10. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I think i had a similar issue, just download it via the asset store instead (after deleting it from the folder on your pc) try that
     
  11. elder0010

    elder0010

    Joined:
    Oct 31, 2015
    Posts:
    14
    i cannot download from the asset store, I just have a "open in unity" link which opens the package manager with the U2018 version!
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Known issue. Unity Package Manager is broken. See this:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#wrong-rewired-version-installed
     
  13. h0neyfr0g

    h0neyfr0g

    Joined:
    Jul 13, 2019
    Posts:
    35
    Hi Guavaman!

    Thanks for this amazing asset, and being very active in this thread!

    I did a search but I'm not sure if the answers I found were directly what I was running into. I recently upgraded to the 2020 release, and I am now greeted with the following:

    Rewired: The version of Rewired installed (1.1.37.0.U2019) was not designed for Unity 2020. Please install Rewired for Unity 2020.

    This warning does not mean that Rewired will not function, but it may not function optimally.

    Some different major versions of Unity download Asset Store assets to the same folder location on disk, so if you download an asset in one version of the Unity editor, then open another version of the Unity editor and install the asset without re-downloading it, the wrong asset version will be installed. To fix this, manually re-download Rewired in the Unity Asset Store panel in this version of the Unity Editor, then install it.

    ---

    Can you help run me through the steps necessary to remedy this?

    Thanks so much
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    See the Troubleshooting documentation:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#wrong-rewired-version-installed

     
  15. JLemmens

    JLemmens

    Joined:
    Aug 24, 2020
    Posts:
    9
    Hey all, I recently purchased Rewired, joy to work with so far.

    I'm however trying to use it with 2 unrecognized controllers at the moment. A SIMAGIC steering wheel, and a set of Fanatec clubsport pedals. Ofcourse I'd like to use them to control a single set of actions, but my problem is that both the throttle and the steer work as axis 0 in their respective unknown controller. Assigning it directly in a joystick layout is not option it seems. I tried working around this using the controller remapper, but no luck so far. Any tips our help would be very welcome!
     
  16. YinYin-Falcon

    YinYin-Falcon

    Joined:
    Nov 20, 2014
    Posts:
    1
    I've got a weird issue.

    My Xbox One controller no longer gets recognised by Rewired since last week, making it not work in game.
    The editor itself and rewired debug still pick up, but only as a generic set of 32 Axes and 144 buttons.
    The latest Windows update pushed itself just before then, so I'm thinking that may have caused it.

    upload_2020-11-18_14-39-14.png

    using
    Windows 10.0.19042
    Unity 2019.4.8f1
    Rewired 1.1.26.1.U2019

    360 controllers/Xinput still work and the Xbox One controller still works through Xinput in older unity/rewired versions. I'm also certain it worked as a native Xbox One controller before, because my custom layout for that and the 360 is slightly different.

    Onto figuring out if any particular part of the update broke this u_u
     
    Last edited: Nov 18, 2020
  17. yanyoumo_unity

    yanyoumo_unity

    Joined:
    Apr 30, 2020
    Posts:
    15
    Hi, there, I'm new to this system. Maybe I missed some obivous, however, I haven't found any meaningful answer.
    Which is, is Rewired could work with Unity native mouse event? Such as OnMouseEnter, which could interactive with collider. I have difficulity finding related info. Could some help with this? Thanks inadvance.
     
  18. diegoadrada

    diegoadrada

    Joined:
    Nov 27, 2014
    Posts:
    59
    Hi, I have a system organized in Controller Maps (UI, Gameplay, Puzzle, etc) and works very well, now I'm working in the initial scene of main menu and I want to add a "Press any key to start" screen, in this case I need to read the input of any key/button, the problem is that in UI Map I don't have all the keys mapped for Keyboard and Gamepad because I don't want to have actions for keys that I'm not going to use except in this specific case.
    I would like to know if there's any way of read when the user press a key/button regardless of which controller map is active.
    Thanks!
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I don't understand. Are you trying to create an Unknown Controller map in the editor for these controllers? Don't. Unknown Controller cannot be used to support a specific controller. It will apply to all controllers, not any specific controller, and cannot be used to target a particular controller unless you want that to be the only controller it maps correctly on.

    With unrecognized controllers, you do not provide a default mapping layout for that specific controller and let the user map it themselves before they use it. The entire purpose of the controller definition and recognition system to to allow you to pre-define controller maps for recognized controllers. If the controller isn't recognized and doesn't have a definition to define all its elements and information about the controller, you can't do it so don't try. The Best Practices documentation states that you must always provide the user a means to remap their controllers. This is why.

    The recommendation to always create an Unknown Controller map still applies because it allows a controller to have some kind of mapping, even if nonsensical, at start. Then the user can map it how they like.
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Rewired 1.1.26.1.U2019 is 1.5 years old. I cannot provide support on such an old version. Update Rewired and try again.
     
    YinYin-Falcon likes this.
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    No. Rewired has no relation to Unity's MonoBehavior events.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    If the element is not mapped through a Controller Map, it has no connection to the Player-Action system. You are talking about Controller-level input which is below the Player-Action system and does not use Controller Maps or Actions.

    You have full access to everything in Rewired including the Controllers to get whatever information you want from them. Any information can be obtained through calling functions on the Controller or through certain convenience functions like this:

    ReInput.controllers - Functions for Controllers system-wide.
    Player.controllers - Functions for Controllers assigned to a Player
    Joystick class
     
    diegoadrada likes this.
  23. JLemmens

    JLemmens

    Joined:
    Aug 24, 2020
    Posts:
    9
    I have found a bit of a workaround at the moment, if a hacky one. I use 2 players, 1 controller assigned to each so the unknown controller "axis 0" they both have don't override each other. I am working on getting a remapper implemented for easier setup.
     
  24. JLemmens

    JLemmens

    Joined:
    Aug 24, 2020
    Posts:
    9
    So what I'm trying to do at the moment is use 2 unknown controllers to control 1 player, if that makes sense. A steering wheel to handle steering and additional buttons and a set of pedals to handle acceleration, clutch and brakes. In trying to set up a control mapper, I can succesfully read inputs from the pedals to remap them, but not from the steering wheel, even though they succesfully debug in the rewired input manager inspector. The remapper displays both controllers seperately. Is there a way to just display the actions from a player, without including multiple controllers?
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I don't understand why you say both controllers using Axis 0 is a problem. Each controller has separate axes. Axis 0 on one controller has no relation to Axis 0 on another controller. Each Controller Maps bind the axes on an individual Controller to Actions. A Controller Map for Controller A cannot and does not apply to Controller B. The only way the two axes would fight with each other is if Axis 0 on Controller A bound to SomeAction and Axis 0 on Controller B is also bound to SomeAction. The Action is the combined value of the two bindings. The fact that both are Axis 0 is irrelevant as the same thing would happen with Axis 12 and Axis 7 being bound to the same Action. The only way you would ever get this conflict is with the Unknown Controller map where you have defined Axis 0 to be bound to SomeAction which would get loaded on both controllers. You haven't clarified whether or not you're using the Unknown Controller map, so I'm just guessing here. The solution is to rebind the controls at runtime using something like Control Mapper.

    If the wheel is returning a value to Rewired (can be verified using Debug Information -- see the checklist at the end), it can be remapped. If the wheel axis is not returning a value in the Controller Axis, nothing is going to make it work because no value is being returned by the low-level input API. If it is returning a value, the only thing that could possibly prevent it from being detected when polling is a very poorly calibrated axis that is returning a very small value from min to max. Polling requires a change in value of 0.7+ from the start of polling to detect the axis.

    >> Is there a way to just display the actions from a player, without including multiple controllers?

    Rewired's Action system is Controller-centric. Each Controller Map belongs to a single Controller. Remapping is a Controller Map-based action. You select the Controller Map you want to listen to input for and it listens only to that Controller that owns that Controller Map. When a binding is made, it is made on that specific Controller Map that is listening for bindings. You cannot abstract away the Controller / Controller Map nature of Rewired and instead bind to a global list of Action bindings. That is how many other input systems work, but not Rewired. While it may be possible to make the UI appear to abstract away this Controller-centric design, it is very difficult to do so and would require a lot of work to make a square peg fit in a round hole.
     
    Last edited: Nov 19, 2020
  26. ledshok

    ledshok

    Joined:
    Oct 28, 2012
    Posts:
    28
    @guavaman - any reason why Rewired was removed from the 'Best of Super Sale'?
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    It was not in the sale. I haven't put Rewired on sale for many years. The cost is already too low for the amount of time and effort I put into maintaining and supporting it.
     
  28. ledshok

    ledshok

    Joined:
    Oct 28, 2012
    Posts:
    28
    Ah, for some reason I was certain I'd seen it in the sale list when I was scrolling through the other day. Made sense too, since Rewired is surely considered one of the 'best ofs'.

    Anyway, my mistake. Thanks for the prompt reply. :)
     
  29. Foxeh-3

    Foxeh-3

    Joined:
    Jan 19, 2018
    Posts:
    4
    ok I've been trying to figure this out on my own for a while, but i can't seem to find anything in the documentation or examples. Maybe I'm overlooking though..

    I'm simply trying to separate the action id of an axis to 2 values, positive and negative without mapping to both.

    ex: i have a Horizontal action for moving left and right, and i have 2 buttons, that's marked by left and right by their positive and negative descriptive names.. while i can select one and poll for an input.. my result ends up mapping to both, instead of only one.

    i'd really be thankful if someone can point me in the right syntax to what i'm possibly missing.

    here's my code
    Code (CSharp):
    1.     private void Start()
    2.     {
    3.         if(ReInput.isReady)
    4.         {
    5.             // Timeout after 5 seconds of listening
    6.             inputMapper.options.timeout = 5f;
    7.  
    8.             // Ignore Mouse X and Y axes
    9.             inputMapper.options.ignoreMouseXAxis = true;
    10.             inputMapper.options.ignoreMouseYAxis = true;
    11.  
    12.             // Subscribe to events
    13.             ReInput.ControllerConnectedEvent += OnControllerChanged;
    14.             ReInput.ControllerDisconnectedEvent += OnControllerChanged;
    15.             inputMapper.InputMappedEvent += OnInputMapped;
    16.             inputMapper.StoppedEvent += OnStopped;
    17.  
    18.  
    19.         }
    20.     }
    21.  
    22.     private void Update()
    23.     {
    24.         player = usedController.player;
    25.         controller = usedController.controller;
    26.  
    27.         //input map category
    28.         InputMapCategory = ReInput.mapping.GetMapCategory("Default");
    29.         InputMapCategoryName = InputMapCategory.name;
    30.         InputMapCategoryID = InputMapCategory.id;
    31.  
    32.  
    33.  
    34.  
    35.         if (controller != null)
    36.         {
    37.             if (controller.type != ControllerType.Mouse)
    38.             {
    39.                 SelectedControllerID = controller.id;
    40.  
    41.                 MapId = player.controllers.maps.GetFirstButtonMapWithAction(ActionNameToMap, skipDisabledMaps: true).actionId;
    42.  
    43.                 ControllerMap = player.controllers.maps.GetMap(controller, InputMapCategoryName, "Default");
    44.                
    45.                 InputAction = ReInput.mapping.GetAction(ActionId);
    46.                
    47.  
    48.                 actionElementMapToReplaceId = ControllerMap.GetFirstElementMapWithAction(MapId);
    49.                 if (InputAction.type == InputActionType.Axis)
    50.                 {
    51.                     if(PositiveAxis)
    52.                     {
    53.                         InputActionName = InputAction.positiveDescriptiveName;
    54.                     }
    55.                     else if (!PositiveAxis)
    56.                     {
    57.                         InputActionName = InputAction.negativeDescriptiveName;
    58.                     }
    59.                 }
    60.                 else if (InputAction.type == InputActionType.Button)
    61.                 {
    62.                     InputActionName = InputAction.name;
    63.                 }
    64.  
    65.                 ActionText.text = InputActionName;
    66.  
    67.                 if (!IsListening)
    68.                 {
    69.                     ButtonText.text = player.controllers.maps.GetFirstButtonMapWithAction(controller.type, SelectedControllerID, InputAction.id, skipDisabledMaps: true).elementIdentifierName; //gets button name
    70.                 }
    71.  
    72.             }
    73.         }
    74.        
    75.     }
    76.  
    77.  
    78.     //listens for a button input after a delay
    79.     public IEnumerator StartListeningDelayed()
    80.     {
    81.         IsListening = true;
    82.         // Don't allow a binding for a short period of time after input field is activated
    83.         // to prevent button bound to UI Submit from binding instantly when input field is activated.
    84.         yield return new WaitForSeconds(0.1f);
    85.  
    86.         // Start listening
    87.         inputMapper.Start
    88.             (
    89.             new InputMapper.Context()
    90.             {
    91.                 actionId = ActionId, //the id of the Action being mapped
    92.                 controllerMap = ControllerMap, //the controller map which will have the new mapping added
    93.                 actionRange = ActionRange, // the range of the action being mapped
    94.                 actionElementMapToReplace = actionElementMapToReplaceId
    95.             }
    96.  
    97.             );
    98.         // Disable the UI Controller Maps while listening to prevent UI control and submissions.
    99.         player.controllers.maps.SetMapsEnabled(false, uiCategory);
    100.  
    101.         // Update the UI text
    102.         ButtonText.text = "Listening...";
    103.        
    104.     }
    and here's a gif to show what's happening..
    the inputs for buttons works fine, but my axis for horizontal and vertical on the other hand..

     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    There a 4 complete, working examples of controller remapping. Mapping of axes is covered in all 4 examples. This is definitely covered because this problem doesn't happen with any of the examples, including the SimpleControlRemapping example you are basing this on.

    First, You have removed the full-axis assignment input field that the example shows. In the example, you have Walk (full-axis assignment), Walk Forward (positive assignment), Walk Backward (negative assignment). By removing this field, you now are no longer allowed to make or even have pre-existing (defined in the Rewired Input Manager) full-axis assignments. If you do, you will not be able to see them and you will get conflicts when you try remapping things. All axis bindings must be split.

    The problem is not in the code you have posted as far as I can tell. The problem is in the input fields themselves. It appears to be that both Up and Down are binding to the same pole of the Action. I cannot see where PositiveAxis is set, but it looks like to me this value is always either true or false. You can easily verify what is actually happening to the mappings by using Debug Information to view the live ActionElementMaps in your Player:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information
     
    Last edited: Nov 24, 2020
  31. Microck

    Microck

    Joined:
    Oct 6, 2015
    Posts:
    5
    Hello Guavaman !
    I'm trying to get the value input of an action ("Reload", Action id=5) in order to show it in the game.
    I'm using the playmaker action "Rewired Action Element Map Get Element Identifier Name" but results are empty as you can see:

    Unity 2019.4.15f1 (2019 last version)
    Rewired 1.1.37.0.U2019 (last version)
    Playmaker 1.9.0.p21(last version)

    Thanks !
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Action Id is a completely different thing than Action Element Map Id. You cannot use the Action Id for this purpose.

    Action Element Map Id is the unique, runtime id of the ActionElementMap. You cannot get this from the Rewired Input Manager. You can only get this from the ActionElementMap at runtime. There are next to no Actions available in PlayMaker to do this. The vast majority of the remapping API is scripting-only. The only PlayMaker Action that you can use to get an Action Element Map is RewiredPlayerGetFirstElementMapIdWithAction.
     
  33. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    I need a hero guavaman where are you! :)

    I just upgrade our project to from unity 2018 to 2019 and IT WAS HELL! (To hell with you REIMPORT ALL! I'm told Unreal Engine never does that...)

    After a full day of work I finally got rid of most errors except this one from rewired:

    "The version of Rewired installed (1.1.37.0.U2020) was not designed for Unity 2019. Please install Rewired for Unity 2019."

    I loaded an empty scene, deleted rewired from the project folder, downloaded it using the package manager in 2019.4.15f1 and reinstalled it. Still getting the error even after the re import all.

    I'm guessing 1.1.37.0.U2020 means it's for unity 2020 but I have no clue how this is happening, I deleted my asset store cache before all this so it couldn't have been a version already on my drive.

    Please help!

    Edit: Just deleted rewired and my asset store cache AGAIN redownloaded it and reinstalled and i'm getting the same error.
     
    Last edited: Nov 28, 2020
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    See the documentation:.
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#wrong-rewired-version-installed

    Neither you nor I can fix this because it's a Unity Package Manager problem. See the link for details and instructions.
     
  35. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
  36. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    We're adding Rewired support for another one of our assets. We'd like to offer users the ability to setup Rewired with the click of a button (in the editor outside of play mode). We check if the category exists and add a new one with the following:
    Code (CSharp):
    1. InputCategory inputCategory = null;
    2. int categoryId = rewiredUserData.GetActionCategoryId("Sticky3D");
    3.  
    4. if (categoryId < 0)
    5. {
    6.     rewiredUserData.AddActionCategory();
    7.  
    8.     // Get the new action category added _name is protected
    9.      inputCategory =  rewiredUserData.GetActionCategory(rewiredUserData.GetActionCategoryCount()-1);
    10.  
    11.     if (inputCategory != null)
    12.     {
    13.         // This doesn't work as readonly...
    14.         inputCategory.name = "Sticky3D";
    15.  
    16.         Debug.Log("[DEBUG] Action Category: " + inputCategory.name);
    17.     }
    18. }
    I've looked through the sample scripts include but cannot find a way to set a category name. Maybe I'm missing something obvious.

    I have a similar challenge when trying to add InputActions and update their properties.
     
    Last edited: Nov 29, 2020
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    You cannot configure settings in the Rewired Input Manager through a script. The API for that is partly internal and not documented. The API is subject to change at any time without notice because it's meant to be for internal use only. In this specific case, the InputCategory.name property setter is internal. These classes are used for both stored data and runtime consumption, and none of them were ever meant to be changeable at runtime, therefore the setters are internal so they can be set by Rewired for editor data purposes, but not by the end-user when writing runtime code. The only way you'll be able to do what you want is through reflection.
     
    Last edited: Nov 29, 2020
  38. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    Thanks for the quick reply. This isn't for runtime but I understand if it isn't supported - we're not planning to implement anything that isn't supported.
     
  39. valtan24mb

    valtan24mb

    Joined:
    Apr 2, 2020
    Posts:
    1
    After upgrading Mac to Big Sur, the Nintendo Switch Pro Controller doesn't seem to work anymore. The controller is connected, but the controller inputs are not being detected. Anyone face the same issue?
     
  40. iansnyder

    iansnyder

    Joined:
    Dec 22, 2012
    Posts:
    27
    I have been using a PS4 Dual Shock controller connected with BT on my PC for testing in Unity Editor and it works fine, but when I create a Windows Build all the axis are messed up. I am using Defaults in Editor. I will make a custom mapping for the Dual Shock, but any ideas why it'd be different between the Editor and Windows Build?
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Something works in the editor but not in a Standalone build:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#works-in-editor-not-in-build

    If Steam is involved, see the Steam troubleshooting:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#steam
     
    iansnyder likes this.
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I have no information about changes Big Sur has made to drivers and have not tested it.
     
  43. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Thanks for your continued support on this amazing tool @guavaman ! :rolleyes:
     
    iansnyder and guavaman like this.
  44. Zerogarth

    Zerogarth

    Joined:
    Dec 1, 2020
    Posts:
    2
    Hi! We have been using Rewired for a simulator and have a very specific question: Is there a way to use 2 joystick of the same type (Xbox One) and get different inputs for the same player? (i.e. I need to rotate a mecanism with the right stick on joystick 1, and move the camera with the right stick on joystick 2, using the same player) So far we haven't been able to make it work, as it always recognise the same input if the same button or stick is used on any of the 2 joysticks.

    Any tip or idea is appreciated at this point!
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    You cannot pre-define different maps for multiple identical controllers for the same Player. Map them at runtime and it will work. Or use multiple Players.
     
    Zerogarth likes this.
  46. CurryKitten

    CurryKitten

    Joined:
    Dec 22, 2016
    Posts:
    36
    Hi there,

    I've just moved on in my game from only using axis to also supporting buttons - while this is all fine and works nicely, I did seem to pick up an issue with Rewired detecting the number of Axis/Buttons in my controller incorrectly.

    Screenshot 2020-12-02 at 14.25.10.jpg

    My game is a sim for RX aircraft, so the majority of the time people will connect all sorts of different RC radios. On this particular radio which should have 8 axis and 24 buttons, it's detecting it as 32 axis and 256 buttons. Whilst I can put in a workaround to handle this - it's a bit of a pain.

    It could well be that the radio is showing itself to the system incorrectly, but I don't have a way of checking that out (any suggestions). Although this will be using the unknown controller template, it should understand the correct number of axis/buttons shouldn't it ?
     
  47. Zerogarth

    Zerogarth

    Joined:
    Dec 1, 2020
    Posts:
    2
    Thanks for the answer!
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    What you are describing is exactly how unknown controllers work.

    https://guavaman.com/projects/rewired/docs/ControllerMaps.html#unknown-controllers

    All unrecognized controllers are created as an Unknown Controller which is a controller that contains enough elements to cover all possible controller elements. The number of elements is not tied to what the hardware exposes.

    The Controller you see is a high-level abstraction of a controller based on the Element Identifiers defined in the Controller definition. The Unknown Controller definition is a controller definition just like any other controller definition. It defines 32 axes and 256 buttons as Element Identifiers which then map to sequential Axis 0-31 and Button 0-255 element indices (depends on platform/input source). The Element Identifier list is constant for all platforms, which is the whole purpose of the layer of abstraction. The element index maps varies depending on the platform. This is how all controllers work in Rewired. When you are looking at the Controller in the debug information, you are seeing the Controller created from the Unknown Controller definition. You are not seeing the low-level HID device, or whatever type of device the current platform / input source uses. Each platform / input source may or may not provide information about a device such as element counts. Rewired was made to work regardless of what information is available.
     
    Last edited: Dec 2, 2020
  49. CurryKitten

    CurryKitten

    Joined:
    Dec 22, 2016
    Posts:
    36
    Any advice for how I might go about letting the user remap actions to axis/buttons when I can't present the real number of actual axis/buttons that they have. Whilst I could create a new map for a given controller, there are just too many radios and USB dongles to make this possible.

    What I'd like to do is have a way of being able to show the actual number of axis buttons available, so that the user can assign actions or calibrate axis that actually exist.

    EDIT: Your UnityJoystickElementidentifier tool (in the DevTools) directory does an excellent job of getting the number of axis/buttons in a controller correct. Is there a reason not to expose any of this data to your API in order for it to be referenced from Unity code?
     
    Last edited: Dec 3, 2020
  50. Woblyware

    Woblyware

    Joined:
    Nov 19, 2018
    Posts:
    1
    Hey! Is there any way to determine the controller model on iOS? I'm getting the correct hardwareTypeGuid for a ps4 and Xbox one controller when running the game in editor, but on iOS both controllers show with same iOS MFI controller hardwareTypeGuid(3d919cfa-468e-49f4-bce9-f6c43f2e7e62). I'm looking to display custom controller glyphs in game for both controllers.