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,625
    Thanks. I'll look into it and contact the author about their error.
     
  2. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    531
    Thanks for all of the suggestions, I'll do some digging and let you know what I work out. I thought it would make sense to me by implementation too, and still might be, but I just don't understand why it works on for every other controller. Anyway, I'll report back, I was just hopeful it might have been some noobie thing I wasn't aware of. I better try another controller as well just to rule out a manufacturing fault with the buttons themselves.
     
  3. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    531
    Ok... I got to the bottom of it and embarrassingly it was in my implementation, but I'm actually relieved it was to be honest. Much better than it being something lower lever. What I thought was code running consistently across all platforms wasn't correct, there was something I had buried in the code that filters input from a user that's not the primary user that wasn't implemented correctly. My bad, sorry for the false alarm, mystery solved.
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Glad it's resolved.
     
  5. havchr

    havchr

    Joined:
    Jun 18, 2009
    Posts:
    75
    This is mostly just a thank you post - Rewired has made a lot of input related issues much easier for us to manage.

    I do have a small "bug report" - or usability issue to report though in regards to copying an input map category.

    I got a warning about replacing a controller map - and at this point, I read a bit more carefully -
    It seemed I was about to copy my new empty map into the one I was meant to use as a Source.



    It was very good that it gave me a warning and asked if I was sure I wanted to replace it, but unfortunately, the option to not replace seems gone from the dialog box.

    So - sorry about the complaint, because once again - Rewired has made it possible for us to implement joystick input very speedily and with good tools to cover corner cases.

    Best regards!
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Thanks @havchr! I appreciate it and I'm glad you've been happy with Rewired.

    I see I used the overload of EditorUtility.DisplayDialog without a specified "Cancel" title. I thought this overload would automatically display a Cancel button but I guess it doesn't. I'll fix it.
     
  7. iansnyder

    iansnyder

    Joined:
    Dec 22, 2012
    Posts:
    27
    Hey there guavaman -- been using Rewired for a while and I love it! I just tried connecting my bluetooth Xbox One controller to PC for testing, and Unity detects the controller but I can't seem to get it working with Rewired. Any ideas? Thanks!
     
  8. digiwombat

    digiwombat

    Joined:
    Sep 26, 2013
    Posts:
    48
    Hey!

    Super quick question since I couldn't find anything about it in UI or the docs.

    Is it possible to do Mouse Buttons/Wheel + a Keyboard Modifier?

    Something like Ctrl+Right Click or Ctrl+Mouse Wheel?
     
  9. killakiwi

    killakiwi

    Joined:
    Sep 5, 2013
    Posts:
    22
    Is it possible to have an AI simulate input so that rewired doesn't have to care if it's a player or AI?
     
  10. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    killakiwi and guavaman like this.
  11. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Sounds like multiple actions is what you are looking for. See more details in the Rewired docs.

    http://guavaman.com/projects/rewired/docs/HowTos.html#button-combos
     
    guavaman likes this.
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    This kind of issue is too vague with far too many possibilities as to the cause for me to tell you. Use the tools provided to determine why its not working. There's a whole checklist for you to use:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information

    Most likely cause (just a wild guess because I have no information to work with apart from the fact that input doesn't work):
    You have not defined or assigned any controller maps compatible with the controller.
    http://guavaman.com/projects/rewired/docs/ControllerMaps.html#xinput-devices-windows
     
    Last edited: Jul 16, 2019
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
  14. iansnyder

    iansnyder

    Joined:
    Dec 22, 2012
    Posts:
    27
    @guavaman Wow somehow I never saw the Debug Info! Realized I just had two controllers and the Xbox was getting assigned to P2 :D Thanks!
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Rewired 1.1.27.1 is available on the Unity Asset Store:

    See Updating Rewired before updating.

    Release Notes:

    1.1.27.1:

    Bug Fixes:
    - Unity 2018.3+ (new prefab workflow): Pressing "Play" in the editor immediately after changing values in the Rewired Editor while editing a prefab will no longer cause the changes to be lost.


    1.1.27.0:

    Changes:
    - Windows, Raw Input / Direct Input, Native Keyboard Handling: Changed system for correcting UK and German key mappings due to issue it caused with French layout.
    - UserDataStore_PlayerPrefs: Added support for loading Controller Maps for recognized Joysticks that are not currently connected.
    - PS4: Changed value returned by Controller.name from "Gamepad" to "Controller" for gamepad controllers.

    API Changes:
    - Added ReInput.MappingHelper.GetControllerMapInstance(ControllerIdentifier controllerIdentifier...) overloads.
    - Added ReInput.MappingHelper.GetJoystickMapInstance(ControllerIdentifier controllerIdentifier...) overloads.
    - Added ReInput.MappingHelper.GetCustomControllerMapInstance(ControllerIdentifier controllerIdentifier...) overloads.
    - Added ReInput.MappingHelper.GetControllerMapInstanceSavedOrDefault(int playerId, Controller controller, string mapCategoryName, string layoutName) overload.
    - Added ReInput.MappingHelper.GetControllerMapInstanceSavedOrDefault(int playerId, ControllerIdentifier controllerIdentifier, string mapCategoryName, string layoutName) overload.
    - Added ReInput.MappingHelper.GetJoystickMapInstanceSavedOrDefault(int playerId, Joystick joystick, string mapCategoryName, string layoutName) overload.
    - Added ReInput.MappingHelper.GetJoystickMapInstanceSavedOrDefault(int playerId, ControllerIdentifier controllerIdentifier, string mapCategoryName, string layoutName) overload.
    - Added ReInput.MappingHelper.GetCustomControllerMapInstanceSavedOrDefault(int playerId, CustomController customController, string mapCategoryName, string layoutName) overload.
    - Added ReInput.MappingHelper.GetCustomControllerMapInstanceSavedOrDefault(int playerId, ControllerIdentifier controllerIdentifier, string mapCategoryName, string layoutName) overload.
    - Added ReInput.MappingHelper.GetKeyboardMapInstanceSavedOrDefault(int playerId, string mapCategoryName, string layoutName) overload.
    - Added ReInput.MappingHelper.GetMouseMapInstanceSavedOrDefault(int playerId, int mapCategoryId, int layoutId) overload.
    - Added ControllerIdentifier.Blank property.

    Bug Fixes:
    - Windows, Raw Input / Direct Input, Native Keyboard Handling: 4 key on French keyboard layout now returns the correct key code.
    - Rewired Editor: Controller Map "Copy Map" dialog now shows the "Cancel" option when copying over an existing Controller Map.
     
    Bartolomeus755 likes this.
  16. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Hi,
    I just bought Rewired after a long consideration. I have to say, it is amazing! Specially the thorough documentation!
    So far I have one question - does Rewired have something like Mouse.current.WarpCursorPosition in the New Input System by Unity? Our game needs a gamepad controlled cursor at some points and this could help me a lot.
    Thanks

    EDIT: Found it here. Well... here I am glorifying the docs... without searching them properly. Sorry for that :oops:
     
    Last edited: Jul 24, 2019
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    There is no equivalent function to WarpCursorPosition. See the FAQ:
    http://guavaman.com/projects/rewired/docs/FAQ.html#set-mouse-cursor-position
     
  18. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    Hello,
    I'm adding buttons to my screen for an accessibility mode, but I'd like the button presses to show up as actions in rewired. For example, if I press a button on the screen and then I poll rewired for my X button, it will be the same as if I pushed the button on my controller.

    Is this possible?
    (P.S. I've been googling and looking in the documents but have yet to find anything)
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    http://guavaman.com/projects/rewired/docs/CustomControllers.html
     
  20. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    Hmmm, we tried that and SetButtonValue was definitely being hit but didn't have any effect. There's another spot in the code that uses the SetButtonUpdateCallback. Can those two things conflict with each other?

    Update: We're going to do some experimenting and post back what our problem was. Thanks for letting us know were were on the right track.
     
    Last edited: Jul 24, 2019
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Use Debug Information to determine what's happening:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information

    There's a lot more involved than just setting a value. You also need an enabled Controller Map loaded in the Player that maps the Custom Controller button to the Aciton.

    Absolutely. You're setting the value twice. If you set it True when it is first called, then False on the 2nd call, the value will be False by the time Rewired's Action update rolls around and reads the value of the controller button.

    Refer to the examples provided for how to write a Custom Controller script and how to input the values.
     
  22. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    That is definitely what was happening. Thanks again!
     
  23. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Hi @guavaman Do you have suggestions on how to detect a "FLICK" of the analog stick \ Dpad? I'm using the bottom, but it's not great because NOT RELEASING the analog stick, still calls this.

    Code (CSharp):
    1.         if (_player.GetAxis("LHorizontal") == 0)
    2.         {
    3.             _flickLeft = false;
    4.         }
    5.  
    6.         if (_player.GetAxis("LHorizontal") < 0)
    7.         {
    8.             if (!_flickLeft)
    9.             {
    10.                 _flickLeft = true;
    11.             }
    12.         }
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    In general, I don't provide support on how to process input or implement functionality based on the input provided. Processing of input values is outside Rewired's responsibility. You can use the input values it produces for anything you want and process them in any way you want. The input values that Rewired provides are the same as any input values you would get from any other input system and how you process these values to achieve the results you are looking for is universal and not dependent on the input system providing these values.

    What you are trying to do requires that you compare a previous value to a current value because you're only interested in the change in value. Rewired already has built-in functionality for what you're trying to do. player.GetButtonDown and player.GetNegativeButtonDown. See the documentation:

    http://guavaman.com/projects/rewired/docs/HowTos.html#get-input
    http://guavaman.com/projects/rewired/docs/HowTos.html#button-press-types

    All Actions can be queried as Buttons regardless of the underlying input source. This uses the Input Behavior Button Dead Zone to determine how far the axis must be moved before a True button state will be returned. ButtonDown returns True only on the first frame the condition is met.

    If you don't want to use this, compare the axis value in the current frame to the axis value in the previous frame to detect the crossing of the threshold at whatever point you want it to activate.

    player.GetAxis
    player.GetAxisPrev
     
  25. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606

    Thanks for the help! Going to dig in a bit !

    BTW this link doesn't work. It doesn't take me to the section "Method 1: Player Polling" .. I had to kinda guess what it did by clicking the second link "Using Player input events"
    http://guavaman.com/projects/rewired/docs/HowTos.html#get-input-polling-player
     
  26. longroadhwy

    longroadhwy

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

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    That's interesting. But these modular sticks do pose a problem. Rewired's recognition system is based on matching known identifiers to pre-defined data about the device. Switching out a stick handle or steering wheel head without the device information changing completely breaks that system. The element names will be wrong if the definition was created for the stock Warthog base. It would be even worse if the stick has a different number of elements on it, in which case some may not even work at all. In these cases, the only solution would be to remove the controller definition and force the user to map their own controls using the Unknown Controller definition.

    It's very cool that MS is reviving Flight Simulator after all these years! Definitely a classic.
     
  28. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    It will be interesting to see if F-18C grip becomes popular especially with its $229 price point. They both have the same number of buttons which is 19. The first review on Amazon complains of quality problems so it maybe too early to tell what interest level is in the product.

    The review I saw of it the DCS mapping (which is spoken about as a "launch software") did not map what was expected for the reviewer. But looking at the mapping a good 90% of the buttons are exact matches but the other differences are due to the grip ergonomics. There no new drivers for the grip but only drivers for the Warthog.

    The virpil (another hotas manufacturer) has a base that also supports warthog grip and this new F-18C grips works the same.
     
    guavaman likes this.
  29. the_mr_matt

    the_mr_matt

    Joined:
    Jul 21, 2015
    Posts:
    124
    Hello!

    I'm trying to build a simple keybind system however my UI has limited space. As such, I would much prefer to combine keyboard/mouse/controller bindings. What I have so far is a system that automatically creates the UI, and there are 2 options for each action. As you can see, Camera > Pitch has a mouse binding, and the others are keyboard (i.e. they are all mixed).

    Now I'm struggling to finish it off - I can't figure out how to change keybinds at runtime. I've looked extensively through the docs, the simple control remapping examples, and the control mapper, but I just don't understand. I've managed to get the InputMapper going but nothing appears to happen. However when I debug it to the console, it revealed that every time I click the button, it adds a new binding - it doesn't replace the one I clicked on.



    Here is the code, I'll draw your attention to ListenForNewKeybind().

    Code (CSharp):
    1. namespace Winglett.RR.Settings.Keybinds
    2. {
    3.     public class Keybinds : MonoBehaviour
    4.     {
    5.         [SerializeField] private RectTransform m_Content;
    6.         [SerializeField] private GameObject m_HeaderPrefab;
    7.         [SerializeField] private GameObject m_KeybindPrefab;
    8.  
    9.         private InputMapper m_InputMapper = new InputMapper();
    10.         private List<Row> m_Rows = new List<Row>();
    11.  
    12.         private class Row
    13.         {
    14.             public KeybindRow row;
    15.             public InputAction action;
    16.             public AxisRange axisRange;
    17.         }
    18.  
    19.         private void Start()
    20.         {
    21.             foreach (var category in ReInput.mapping.ActionCategories)
    22.             {
    23.                 GameObject row = Instantiate(m_HeaderPrefab, m_Content);
    24.                 row.GetComponent<KeybindRow>().m_Label.text = category.descriptiveName;
    25.  
    26.                 foreach (var action in ReInput.mapping.ActionsInCategory(category.id))
    27.                 {
    28.                     if (action.type == InputActionType.Axis)
    29.                     {
    30.                         InitializeRow(action, AxisRange.Full);
    31.                         InitializeRow(action, AxisRange.Positive);
    32.                         InitializeRow(action, AxisRange.Negative);
    33.                     }
    34.                     else if (action.type == InputActionType.Button) InitializeRow(action, AxisRange.Positive);
    35.                 }
    36.             }
    37.         }
    38.  
    39.         private void OnEnable()
    40.         {
    41.             // Subscribe to events
    42.             m_InputMapper.InputMappedEvent += OnInputMapped;
    43.         }
    44.  
    45.         private void OnDisable()
    46.         {
    47.             m_InputMapper.Stop();
    48.             m_InputMapper.RemoveAllEventListeners();
    49.         }
    50.  
    51.         private void RedrawUI()
    52.         {
    53.             for (int i = 0; i < m_Rows.Count; i++)
    54.             {
    55.                 RedrawRow(m_Rows[i].row, m_Rows[i].action, m_Rows[i].axisRange);
    56.             }
    57.         }
    58.  
    59.         private void InitializeRow(InputAction action, AxisRange axisRange)
    60.         {
    61.             // Spawn the prefab
    62.             GameObject row = Instantiate(m_KeybindPrefab, m_Content);
    63.  
    64.             // Choose the name
    65.             string name = "";
    66.             switch (axisRange)
    67.             {
    68.                 case AxisRange.Full:
    69.                     name = action.descriptiveName;
    70.                     break;
    71.                 case AxisRange.Positive:
    72.                     name = action.positiveDescriptiveName;
    73.                     break;
    74.                 case AxisRange.Negative:
    75.                     name = action.negativeDescriptiveName;
    76.                     break;
    77.             }
    78.  
    79.             // Save the row
    80.             m_Rows.Add(new Row
    81.             {
    82.                 row = settings,
    83.                 action = action,
    84.                 axisRange = axisRange
    85.             });
    86.  
    87.             RedrawRow(settings, action, axisRange);
    88.         }
    89.  
    90.         private void RedrawRow(KeybindRow settings, InputAction action, AxisRange axisRange)
    91.         {
    92.             // Initialize
    93.             string label1 = "";
    94.             string label2 = "";
    95.             int id1 = 0;
    96.             int id2 = 0;
    97.             ControllerMap map1 = null;
    98.             ControllerMap map2 = null;
    99.  
    100.             // Find the first two bindings
    101.             foreach (var controllerMap in GetPlayer.Player.controllers.maps.GetAllMaps())
    102.             {
    103.                 var actionsElementMaps = controllerMap.GetElementMapsWithAction(action.id);
    104.                 foreach (var item in actionsElementMaps)
    105.                 {
    106.                     // If Full and Axis, or,
    107.                     // Button, and Positive & Positive, or, Negative & Negative
    108.  
    109.                     if ((axisRange == AxisRange.Full && item.elementType == ControllerElementType.Axis) ||
    110.                         (item.elementType == ControllerElementType.Button && ((axisRange == AxisRange.Positive && item.axisContribution == Pole.Positive) || (axisRange == AxisRange.Negative && item.axisContribution == Pole.Negative))))
    111.                     {
    112.                         if (label1 == "")
    113.                         {
    114.                             label1 = item.elementIdentifierName;
    115.                             id1 = item.elementIdentifierId;
    116.                             map1 = controllerMap;
    117.                         }
    118.                         else if (label2 == "")
    119.                         {
    120.                             label2 = item.elementIdentifierName;
    121.                             id2 = item.elementIdentifierId;
    122.                             map2 = controllerMap;
    123.                         }
    124.                         else break;
    125.                     }
    126.                 }
    127.             }
    128.  
    129.             // Assign the labels
    130.             settings.m_ButtonLabel1.text = label1;
    131.             settings.m_ButtonLabel2.text = label2;
    132.  
    133.             // Setup on click methods
    134.             settings.m_Button1.onClick.RemoveAllListeners();
    135.             settings.m_Button2.onClick.RemoveAllListeners();
    136.  
    137.             settings.m_Button1.onClick.AddListener(() =>
    138.             {
    139.                 StartCoroutine(ListenForNewKeybind(action, map1, axisRange, id1));
    140.             });
    141.             settings.m_Button2.onClick.AddListener(() =>
    142.             {
    143.                 StartCoroutine(ListenForNewKeybind(action, map2, axisRange, id2));
    144.             });
    145.         }
    146.  
    147.         private IEnumerator ListenForNewKeybind(InputAction action, ControllerMap map, AxisRange range, int elementMapID)
    148.         {
    149.             // Don't allow a binding for a short period of time after input field is activated
    150.             // to prevent button bound to UI Submit from binding instantly when input field is activated.
    151.             yield return new WaitForSeconds(0.1f);
    152.  
    153.             m_InputMapper.Start(new InputMapper.Context
    154.             {
    155.                 actionId = action.id,
    156.                 controllerMap = map,
    157.                 actionRange = range,
    158.                 actionElementMapToReplace = map.GetElementMap(elementMapID)
    159.             });
    160.  
    161.             Debug.Log("Listening...");
    162.         }
    163.  
    164.         private void OnInputMapped(InputMapper.InputMappedEventData data)
    165.         {
    166.             RedrawUI();
    167.  
    168.             foreach (var controllerMap in GetPlayer.Player.controllers.maps.GetAllMaps())
    169.             {
    170.                 var actionsElementMaps = controllerMap.GetElementMapsWithAction(data.actionElementMap.actionId);
    171.                 foreach (var item in actionsElementMaps)
    172.                 {
    173.                     Debug.Log($"Name: {item.actionDescriptiveName}, {item.elementIdentifierName}, {item.axisContribution}");
    174.                 }
    175.             }
    176.         }
    177.     }
    178. }
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Code (csharp):
    1. if (label1 == "")
    2. {
    3.     label1 = item.elementIdentifierName;
    4.     id1 = item.elementIdentifierId; // <-- WRONG
    5.     map1 = controllerMap;
    6. }
    7. else if (label2 == "")
    8. {
    9.     label2 = item.elementIdentifierName;
    10.     id2 = item.elementIdentifierId; // <-- WRONG
    11.     map2 = controllerMap;
    12. }
    13. ...
    14. StartCoroutine(ListenForNewKeybind(action, map1, axisRange, id1));
    15. ...
    16. private IEnumerator ListenForNewKeybind(InputAction action, ControllerMap map, AxisRange range, int elementMapID)
    You are using Element Identifier Id instead of Element Map Id. They are absolutely not the same thing. Element Map Id is a unique id of the Action Element Map and is used to select the Action Element Map to replace. ActionElementMap.id.
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Good to know at least the button count is the same.
     
  32. autumn_737

    autumn_737

    Joined:
    Jul 23, 2012
    Posts:
    19
    Hi,
    I feel I'm doing something incorrectly.I'm using playmaker action as well.

    I want to show which player's controller is disconnected.
    The action: Rewired Controller Disconnect Event is able to store the controller ID

    How do I go about grabbing the controller ID from a player (player id) so I know which player is disconnected?

    Rewired Get Controller Id says gets the unique id of this controller. Which value is 'this' and is store value the result?

    Is there a better way to do this?


    Also I've noticed from Autoassign joystick on editor play: if Player 1 (id 0) is keyboard and mouse and Player 2 (id1) is controller I get no input response from controller. Only when I stick another controller in I get Player 2 input working.

    Thanks for your help.
     
    Last edited: Jul 29, 2019
  33. longroadhwy

    longroadhwy

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

    Just noticed a new Rewired 1.1.27.2 release on the asset store just now too.

    = = = = =

    1.1.27.2:

    Controller Definitions:
    - Added D-Pad buttons to Apple TV Siri Remote definition.

    Bug Fixes:
    - Fixed gamepads not working on PS4 platform due to change in 1.1.27.0.
    - Unity 2018.3+ (new prefab workflow): Changes are no longer lost after importing data from json or compacting ids from the Rewired Editor -> Tools menu when in "prefab edit mode" and then exiting "prefab edit mode."
     
    Last edited: Jul 29, 2019
    guavaman likes this.
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Use RewiredPlayerControllerRemovedEvent. Otherwise, you have to use RewiredControllerPreDisconnectEvent, not RewiredControllerDisconnectEvent because the Controller is no longer connected and no longer assigned to a Player so you cannot query the Player to see if it's assigned. RewiredPlayerContainsController.

    RewiredControllerGetId is basically useless because it requires the Controller Id to select which controller you are referring to. This Action was only created because Controller.id is in the API and for other systems like Behaviour Designer which can pass arbitrary objects around that represent the Controller instead of having to retrieve it using the id and type every time.

    You're going to have to explain your setup more clearly. Rewired does not have any kind of "Keyboard/Mouse" vs "Joystick" assignment system. Joystick Auto-Assignment assigns Joysticks to any Players that need them when one is connected based on the rules you've set in the Joystick Auto-Assignment settings. Read this:
    http://guavaman.com/projects/rewired/docs/Controllers.html#joysticks

    If your goal is to treat "Keyboard/Mouse" equivalently to "Joysticks" and have Rewired only assign Joysticks to Players that don't have the Keyboard assigned, you're going to have to manage this yourself.
    http://guavaman.com/projects/rewired/docs/HowTos.html#excluding-players-from-joystick-assignment

    Finally, not understanding what's happening with regard to Joystick assignment, Controller Maps, or anything else can be solved by using Debug Information to view every Rewired object live in real-time:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Yes. I just got the notification from the Asset Store now. This update is important for the PS4 platform.
     
  36. the_mr_matt

    the_mr_matt

    Joined:
    Jul 21, 2015
    Posts:
    124
    That solved the issue. Thanks.

    However, a new issue has surfaced. I just realised that to get input from any of keyboard/mouse/controller I need an input mapper for each one, each with a controller map. I looked at the simple combined example, but that only used one category - I have several.

    Can the approach used in the simple combined example work with multiple categories?
     
  37. autumn_737

    autumn_737

    Joined:
    Jul 23, 2012
    Posts:
    19
    Okay, Thanks for your help
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    You can do anything. You just have to understand what you're doing. FYI, combining all bindings for all controllers into the same field absolutely goes against Rewired's design and is not easy to do because it's not the way the system is designed to work. You're trying to fit a square peg in a round hole. It can be done, but it's messy. It's definitely not something I encourage. I don't provide a one-field input binding example for a reason.
     
  39. lczyzycki7lvls

    lczyzycki7lvls

    Joined:
    Sep 10, 2018
    Posts:
    8
    Hi,

    is there any way to force changing map states to have an immediate effect on the state in the frame where the change is done? So, if I change the active map to one that doesn't have certain actions, can I make sure that GetButtonDown checks or InputEventDelegates for those actions won't still get called in this frame?
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    No. Action values are calculated at the beginning of the frame. You can't force the system to recalculate Action values at an arbitrary time.

    Doing something like this would require you know exactly your script execution order since you would never know whether one consumer of an Action value would be called before another consumer which then changes the value. It would also cause problems with all prev/current state tracking, time tracking, delta values, and anything that depends on the fact that the Actions are updated once per frame.
     
  41. jtannert17

    jtannert17

    Joined:
    Jun 1, 2017
    Posts:
    8
    Hi,

    Now that 2019.2 is out of beta will there be an update to fix the missing UnityEngine.UI reference errors?

    Cheers,
    Jack.
     
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    There is no "fix" possible that I know. This was supposed to be resolved by Unity in the beta.

    I and many other asset developers have been struggling with massive changes in Unity 2019.2 beta that broke every single thing Unity UI related for the last several months due to them breaking all DLL's that link to the library in their attempt to move Unity UI into the package manager. That problem made the project not even testable in the beta. They finally supposedly fixed that problem in beta 8.

    Edit: See this for the solution.
     
    Last edited: Aug 1, 2019
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    So I have tried many things and have discovered something very important:

    You only get this error when upgrading a project to 2019.2. This does not happen in a new project.

    So this error is not an error in Rewired. It's an error in Unity's upgrade process and dealing with some kind of stored metadata.

    Edit: See this for the solution.
     
    Last edited: Aug 1, 2019
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
  45. jtannert17

    jtannert17

    Joined:
    Jun 1, 2017
    Posts:
    8
    Hey,

    Thanks for that information I will give that a shot and get back to you. Have you submitted a Unity bug report for this that I can track?

    Cheers,
    Jack.
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    No I haven't.
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Upon further testing, it appears all of the errors are false and do not have any effect. The errors will return after a Reimport All operation, probably due to the same reason the errors appeared in the first place during the upgrade.

    There is no action required. The next time you open the editor, the errors will not appear. Even if you don't close and open the editor, the errors will not have any effect. They are probably reported during the update operation before the UnityUI.dll is created, then the Rewired DLLs must be getting reimported automatically because they do work. It must be a order of operations issue.

    This issue looks to be purely cosmetic.
     
    Last edited: Jul 31, 2019
  48. jtannert17

    jtannert17

    Joined:
    Jun 1, 2017
    Posts:
    8
    Hey again,

    I can confirm that works.. Works in editor and in a standalone build. Thanks for your help!

    You should really put a bug ticket in, Unity may be able to help out here.

    Cheers,
    Jack.
     
  49. utkarshdwivedi3997

    utkarshdwivedi3997

    Joined:
    Aug 11, 2017
    Posts:
    25
    I'm trying to make my own custom input mapper. I am trying to use
    ReInput.mapping.GetKeyboardMapInstance()
    to get the maps I want to modify.

    I know Rewired is Player centric, but I'm in a unique situation where I need this modification to affect all my players (or at least a list of those players). Is there a way to replace every player's
    ActionElementMap
    s in the specific map with all
    ActionElementMap
    s from the changed instance?

    Also, I have followed all the Rewired examples and I have pretty much the exact same code, but for some reason when I start polling for mouse input using a mouse input mapper, it never fires the InputMapped event, no matter what I do. I can provide more details about this if needed, but I feel like I might be missing something very trivial?
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Do it manually. There is nothing in the Rewired API that will do this for you. You have access to every object in Rewired. You have access to all Players, all their ControllerMaps, and all the contained ActionElementMaps within every Controller Map. The entire contents of these objects is exposed through the API. Action Element Maps expose all mapping properties:
    http://guavaman.com/projects/rewired/docs/api-reference/html/T_Rewired_ActionElementMap.htm

    I don't have any information to help you. If you run the example and it works and your code doesn't then you know there's a problem in your code or configuration.