Search Unity

Rewired - Advanced Input for Unity

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

  1. leocastanhob

    leocastanhob

    Joined:
    Sep 19, 2018
    Posts:
    6

    Thanks so much for the fast reply <3

    Thanks for the explanation! For some reason I didnt understand that I could use Player.GetButtonRepeating with axis.

    Sorry, but now Im having another problem.
    - Player.GetButtonRepeating is returning true only when pressing the positive value of the axis. Do I need to do a specific setup for the negative?
    - For some reason Player.GetButtonRepeating is returning true twice before the delay starts.

    Thanks!

    Edit: Just found in the settings an option "Activate Action Buttons on Negative Values", so the first problem is "solved" xD
    But the second one is still there.
     
    Last edited: Oct 1, 2022
  2. leocastanhob

    leocastanhob

    Joined:
    Sep 19, 2018
    Posts:
    6
    Yep, it is returning twice. Both logs come from the same place. It its passing thought one dice when it happens. But it doesnt happen always.

    upload_2022-10-1_17-59-7.png
    upload_2022-10-1_18-0-8.png

    My settings are:
    - Button Repeat Rate 30
    - Button Repeat Delay 0.5
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    You are most likely riding the point at which the virtual button state calculated from the axis value is going on and off. Input Behavior Button Dead Zone. You would see GetButtonDown and GetButtonUp both return true twice.

    The only other cause would be calling GetButtonRepeating from Fixed Update without having Fixed Update enabled in the Rewired Input Manager settings.
     
  4. samanabo

    samanabo

    Joined:
    Mar 10, 2015
    Posts:
    51
    Hi, I'm seeing an issue where keyboard input appears to be reset when loading a scene.
    I'm using an intel mac, and rewired version 1.1.42.1U2022. This appears to happen in the editor and in a build of the game.

    Controller input appears to work fine, axis input is not reset between scenes and I can see the AxisTimeActive is maintained across scenes.

    However, when using the keyboard, GetAxis is 0 for a single frame and the AxisTimeActive is reset to zero when loading a new scene.
    This doesn't happen all the time... in fact is seems to only happen if the axis button was not the last button to be pressed. In other words, if I hold down right arrow only and load the scene the issue does not occur. However if I hold right arrow, then press the jump button (space), and then load the scene (while still holding right arrow the issue does occur.

    I'm using Addressables for scene loading, although I believe this was happening using the more traditional SceneManager loading.

    Any help is much appreciated! Thanks!
     
  5. leocastanhob

    leocastanhob

    Joined:
    Sep 19, 2018
    Posts:
    6
    Hmmm I dont know why it keep happening =/
    - I tried to set Button Dead Zone to 0.99, but still happens, it Logs twice the 1 value.
    - Im not calling GetButtonRepeating from Fixed Update and on Rewired Input Manager only Update is enabled.

    Im using this code and it is Logging twice the 1 value
    Code (CSharp):
    1.         private float GetAxis(string actionName)
    2.         {
    3.             if (player.GetButtonRepeating(actionName))
    4.             {
    5.                 var axisValue = player.GetAxis(actionName);
    6.                 Debug.Log(axisValue);
    7.  
    8.                 return axisValue;
    9.             }
    10.  
    11.             return 0;
    12.         }
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    There is no other explanation other than Unity is clearing the state of Input.GetKey when you load the scene. Rewired has no knowledge of scene loading and does not react to it in any way unless the Rewired Input Maanger is not set to "Don't Destroy on Load", in which case Unity destroys the object and Rewired deinitializes.. All keyboard input on MacOS is drawn from UnityEngine.Input.GetKey.
     
    Last edited: Oct 3, 2022
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    It could be your controller's stick having problems. You should test Button Up and Down.

    Code (CSharp):
    1.  
    2. private float GetAxis(string actionName) {
    3.         string s = "";
    4.         float axisValue = 0f;
    5.  
    6.         if(player.GetButtonDown(actionName)) {
    7.             s += actionName + ": Button Down\n";
    8.         }
    9.         if (player.GetButtonUp(actionName)) {
    10.             s += actionName + ": Button Up\n";
    11.         }
    12.         if (player.GetButtonRepeating(actionName)) {
    13.             axisValue = player.GetAxis(actionName);
    14.             s += actionName + ": Button Repeating\n";
    15.             s += "Axis: " + axisValue;
    16.         }
    17.  
    18.         if(!string.IsNullOrEmpty(s)) Debug.Log(s);
    19.  
    20.         return axisValue;
    21.     }
    Set Repeat Delay to 5 seconds to eliminate any accidental activations by holding it down for more than 1/2 second.

    If changing Repeat Delay does nothing, you are loading saved XML data for the Input Behavior and a warning would be logged.

    If you have any other elements on this or any other device mapped to this same Action, that could affect the result if they're contributing some kind of small input, especially if it's a delta value. (Mouse axis would do this.)
     
  8. leocastanhob

    leocastanhob

    Joined:
    Sep 19, 2018
    Posts:
    6
    - I made sure that no other input from other device is happening
    - I tested with keyboard and another controller and it happened the same problem
    - I set repeat delay to 5 and the repeat delay is on 5 (I tested), so im not loading any XML Data
    - Used your code to log and here is the result:
    upload_2022-10-4_22-10-12.png
    Coming from same place and repeating twice for some reason
    upload_2022-10-4_22-10-6.png
    The other two is the same.
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I can't see the full log because each log entry has more than one line in it.

    What I do see is Button Up firing twice in a row with no button downs in between. That is impossible because of how Actions work. An Action's ButtonDown and ButtonUp states are calculated by comparing the previous frame's value to the current frame's value. A button up state requires that prevState == pressed and current state == not pressed. Therefore it is logically impossible for Button Up to ever fire twice in a row.

    This is exactly what would happen if this function were being called from Fixed Update, Rewired's settings are not configured to update input values in Fixed Update, and your physics frame rate is running faster than your game frame rate.

    The only other possibility is that you are calling this function more than once per frame. The Button state of an Action will be the same for the entire frame duration, and calling it more than once will lead to the same result being read twice. I see the timestamp is exactly the same on all frames. I suggest you log UnityEngine.Time.frameCount. This will only tell you update frames and not Fixed Update frames however.

    I suggest you move this debug code into a new MonoBehaviour and paste it into the Update function. I am certain you will see a different result.
     
    Last edited: Oct 5, 2022
  10. leocastanhob

    leocastanhob

    Joined:
    Sep 19, 2018
    Posts:
    6
    Hii thanks for the reply =D
    I created a new Monobehaviour and the problem kept happening on the first joystick, but it stopped happening on the second joystick and on the keyboard.
    Then I decided to go back to my input code that I was first using and the same happened u.u
    The GetButtonRepeating doesn't come from the the same frame indeed! Thanks for letting me know how to find out if this was the problem.

    Conclusion: It seems that the problem is indeed my joystick... At least now it is happening only on one of the Joysticks.
    Maybe Im crazy or too tired, but I tested on the other devices and I was sure that it happened u.u

    Sorry for wasting your time u.u
    At least I learned more about how Rewired works.
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    That doesn't match with what I'm seeing in the log. There should be no way even a bad joystick could ever cause GetButtonUp to fire two frames in a row. I decided to investigate and look at the code and I do see that when you change the setting to make negative axis directions act as positive buttons as you have done, the code is different enough that there could be the possibility of an issue. As a test, please disable "Activate Action Buttons on Negative Value" in the Rewired Input Manager settings and change your code to the following (put in a new MonoBehaviour, Update function):

    Code (csharp):
    1. private float GetAxis(string actionName) {
    2.             string s = "";
    3.             float axisValue = 0f;
    4.             bool pos;
    5.  
    6.             if (player.GetButtonDown(actionName) || player.GetNegativeButtonDown(actionName)) {
    7.                 pos = player.GetButtonDown(actionName);
    8.                 s += actionName + ": Button Down (" + (pos ? "Pos" : "Neg") + "), ";
    9.             }
    10.             if (player.GetButtonUp(actionName) || player.GetNegativeButtonUp(actionName)) {
    11.                 pos = player.GetButtonUp(actionName);
    12.                 s += actionName + ": Button Up (" + (pos ? "Pos" : "Neg") + "), ";
    13.             }
    14.             if (player.GetButtonRepeating(actionName) || player.GetNegativeButtonRepeating(actionName)) {
    15.                 pos = player.GetButtonRepeating(actionName);
    16.                 axisValue = player.GetAxis(actionName);
    17.                 s += actionName + ": Button Repeating (" + (pos ? "Pos" : "Neg") + ")";
    18.                 s += "Axis: " + axisValue;
    19.             }
    20.  
    21.             if (!string.IsNullOrEmpty(s)) Debug.Log(s);
    22.  
    23.             return axisValue;
    24.         }
    This will tell me if there is a bug in how button states are calculated when "Activate Action Buttons on Negative Value" is enabled.
     
  12. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    This helped, thank you for the detailed description! I've got the binding working fine there now. The only remaining issue I'm having is that if I rebind a button, both the original element and the rebound element now works. Meaning: If the game starts with the action Interact bound to A, and I rebind the Interact action to B, now both A and B will toggle the Interact action. I've been able to verify this is occurring by going to the Debug Information in the Rewired Input Manager and watching the pressed/unpressed time values for the Interact action, and it will change with either A or B after remapping Interact to B. I've reviewed the examples a bit and can't seem to find what I'm doing different that would cause that. Here's my updated binding code:

    Code (CSharp):
    1.         public async void RebindAction(int inActionId, AxisRange inAxisRange)
    2.         {
    3.             if(activeControlState == ControlState.Binding)
    4.             {
    5.                 return;
    6.             }
    7.  
    8.             SetActiveControlState(ControlState.Binding);
    9.  
    10.             // Disable the Controller Maps while listening to prevent UI control and submissions.
    11.             SetMapEnableState(false);
    12.  
    13.             await Task.Delay(5);
    14.  
    15.             ActionElementMap elementMap = GetElementMapForAction(inActionId, inAxisRange);
    16.             if(elementMap == null)
    17.             {
    18.                 EndButtonChanging();
    19.                 return;
    20.             }
    21.  
    22.             InputMapper.Context context = new InputMapper.Context()
    23.             {
    24.                 actionId = inActionId,
    25.                 controllerMap = rewiredControllerMap,
    26.                 actionElementMapToReplace = elementMap,
    27.                 actionRange = inAxisRange,
    28.             };
    29.  
    30.             // Start listening
    31.             InputMapper.Default.InputMappedEvent += OnInputMapped;
    32.             InputMapper.Default.ConflictFoundEvent += OnConflictFound;
    33.             InputMapper.Default.Start(context);
    34.         }
    35.  
    36.         private ActionElementMap GetElementMapForAction(int inActionId, AxisRange inAxisRange)
    37.         {
    38.             foreach (var actionElementMap in rewiredControllerMap.ElementMapsWithAction(inActionId))
    39.             {
    40.                 if (actionElementMap.ShowInField(inAxisRange))
    41.                 {
    42.                     return actionElementMap;
    43.                 }
    44.             }
    45.  
    46.             Debug.LogError("--- No ActionElementMap was found for ActionID " + inActionId + " and AxisRange " + inAxisRange);
    47.             return null;
    48.         }
    49.  
    50.         private void OnInputMapped(InputMapper.InputMappedEventData data)
    51.         {
    52.             InputMapper.Default.Stop();
    53.             WaitThenCompletedMapping();
    54.         }
    55.  
    56.         async void WaitThenCompletedMapping()
    57.         {
    58.             UpdateDisplay();
    59.  
    60.             await Task.Delay(5);
    61.          
    62.             EndButtonChanging();
    63.         }
    64.  
    65.         void EndButtonChanging()
    66.         {
    67.             InputMapper.Default.InputMappedEvent -= OnInputMapped;
    68.             InputMapper.Default.ConflictFoundEvent -= OnConflictFound;
    69.  
    70.             // Re-Enable all Categories
    71.             SetMapEnableState(true);
    72.  
    73.             SetActiveControlState(ControlState.Idle);
    74.         }
    75.  
    Any thoughts on what would cause this double-bindng to occur?
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I don't see your OnConflictFound function. This is likely where the problem is.
     
  14. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    NOTE: After posting this I realized that should be ConflictResponse.Cancel Going to test that as soon as I'm back at my desk...

    If a conflict is found, we just abort the binding process like so:

    Code (CSharp):
    1.        
    2.         void OnConflictFound(InputMapper.ConflictFoundEventData data)
    3.         {
    4.             data.responseCallback(InputMapper.ConflictResponse.Add);
    5.             ShowConflictThenClose();
    6.         }
    7.  
    8.         async void ShowConflictThenClose()
    9.         {
    10.             if(BindingConflictOccuredDisplay != null)
    11.             {
    12.                 BindingConflictOccuredDisplay.SetActive(true);
    13.                 await Task.Delay(300);
    14.                 BindingConflictOccuredDisplay.SetActive(false);
    15.             }
    16.  
    17.             EndButtonChanging();
    18.         }
     
  15. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    Alright I got it figured out! The problem is that Rewired is a beast and I'm still wrapping my head around it, LMAO. Seems I didn't have a solid understanding of all the different types of Categories, and I was trying to keep UI and Gameplay bound elements in the same category. Since it was conflicting, it was then just adding the new button. I've since gotten a better understanding of Map Categories, separated the Joystick Maps to have separate UI and Gameplay categories, and everything fell into place.

    Thanks again for the help!
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    This is covered here:

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

    NOTE: It is HIGHLY recommended that you create unique menu-only Actions for these UI controls in a separate controller map category from your game Actions. If you use your in-game actions such as "Move Horizonal" or "Jump" for these UI controls, you run the risk of allowing the user to render the UI unusable because they removed an assignment for one of these game Actions which was also controlling the UI.

    https://guavaman.com/projects/rewired/docs/InputMapper.html#conflicts

    6. Handle assignment conflicts (optional)

    Conflict checking is enabled by default in InputMapper.Options. See How To's - Conflict Checking for more information.

    If you subscribed to the InputMapper.ConflictFoundEvent, you will receive a notification when a conflicting assignment was found during input mapping. The object returned contains complete information about the assignment, the conflicts that were found, and provides a callback to be used to respond to the event.

    Conflict checking is covered here:
    https://guavaman.com/projects/rewired/docs/HowTos.html#conflict-checking
     
    Last edited: Oct 7, 2022
  17. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    443
    I'm having a problem with Rewired on PC (UK keyboard):

    Using polling to map the key to the right of semicolon (the '/@ button) to an action instead binds the key to the left of 1 (top left corner of keyboard) to that action.

    I don't know if there's a way to manually choose that key from the list, but I'm worried that players won't be able to remap to the keys they want (I'm left-handed and always map to IJKL with semicolon and @ being crouch and run)

    Am I missing a setting somewhere? I'm porting my input system from the old Unity input, and my hand-rolled keyboard remapping worked fine with those keys before.

    EDIT: Rewired seems to treat those two keys as the same key: Backquote. As you can see, they aren't the same:
    '
    `
     
    Last edited: Oct 9, 2022
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    All I can tell you is to disable Native Keyboard Handling in the Rewired settings for the Windows platform. Rewired does not support non-US keyboard layouts, just as UnityEngine.Input doesn't. Rewired's Windows Native Keyboard Handling code was designed to mirror 100% exactly the results of UnityEngine.GetKey and even Keyboard Maps use the same UnityEngine.KeyCode in the public API because it was intended to be a 1:1 replacement. The only reason I made the native implementation in the first place was the fact there was a serious bug in their keyboard system in the particular version of Unity at the time I created it. Native Keyboard Handling was to get around that bug. And at the time I wrote it, I tested with many different keyboard layouts and compared Rewired's results to Unity's result. Obviously I don't have their source code to see exactly how they implemented keyboard input, but my results at that time indicated to me that I had implemented it in the same way they had through the Windows API. If Unity has since changed something under the hood for specific non-US layouts, the same change has not been made in Rewired's native Windows keyboard input code.

    Several times in the last many years, I made changes to accommodate complaints about certain non-US keyboard layouts. I should never have done this because Rewired never advertised special support for non-US keyboard layouts and the Windows native keyboard handling was always intended to be a 1:1 mirror of UnityEngine.Input. To design true international keyboard support would require a redesign of the system and features such as location-based keys. Regardless, I did make special case changes for UK, UK Extended, German, and Danish keyboards due to errors reported by users (errors that were identical in Unity's implementation). These changes are to map the "OEM" keys to the right key on the keyboard. OEM keys are keys which are defined by the layout and vary what they return based on the particular layout. Windows will return only an OEM key code for certain keys that are pressed such as OEM 7 for the Quote key and OEM 3 for the Back Quote key on US keyboards. These OEM keys change depending on the layout and are device defined. In order to "fix" an issue reported to me many years ago in how Unity and Rewired reported certain keys on the UK keyboard layout, Rewired now maps Oem 8 to Back Quote and Oem 3 to Quote. This was based on both the user report and testing of my own with the UK keyboard layout. Nothing should have changed since this was implemented.
     
  19. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    443
    I shall give that a try. As I said: for the last year or so, Unity's old input system has allowed me to bind controls to these keys, so, worst case, I just revert to what I had. Thanks for responding.
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I just installed the UK keyboard layout and pressed the key you are referring to and this is the result:

    Rewired: Quote
    Unity: Back Quote

    Unity is reporting this key as back quote in Unity 2021.1.0f1. This key is not a back quote key (the key to the left of 1) from the images I see on the internet:



    This is exactly the "bug" I fixed for that user I mentioned. Rewired correctly maps this key to quote, not back quote as Unity is mapping it.

    Disabling Native Keyboard Handling will give you exactly the same result as UnityEngine.Input because that is exactly what it is. When it is disabled, the keys are directly driven by UnityEngine.Input.GetKey.
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Just tested Unity 2022.1.0f1 and Unity changed the mapping of that key to Quote, just like Rewired has mapped it for years.
     
    Last edited: Oct 9, 2022
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Reading your original message again, you're saying Rewired, with Native Keyboard Handling enabled, is reporting that key as backquote? It definitely should not be. As I have outlined above, Rewired explicitly maps this key on the UK keyboard to Quote. If it's being reported as Backquote, then your keyboard is not being identified by Windows as a UK keyboard layout through the Windows API function used to determine the current keyboard layout, or there is some additional factor I am not aware of. I misread it the first time as you saying the opposite, because based on my experience, Unity has always mapped this key incorrectly as backquote, and my testing of Unity 2021 and 2022 show that their addition of a UK-specific mapping for this key was a very recent change, and I was not aware they had done that.

    Rewired calls GetKeyboardLayoutNameW to identify what keyboard layout is in use. The value returned should be the following for a UK keyboard:

    https://learn.microsoft.com/en-us/w...-language-pack-default-values?view=windows-11

    0x00000809

    This is used to then look up the OEM key map and map that key to quote, not back quote. And that's exactly what I'm seeing in my testing. So what that's telling me is something is not working correctly with regard to identifying that keyboard layout on your system for some unknown reason. This is just a guess -- are you using a language other than English on your system?

    What version of Rewired are you using?
     
    Last edited: Oct 9, 2022
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    If you can, please run this script. Place it on a GameObject in an empty scene and press Play, then send me the log output: This will show me the keyboard identifier being returned by Windows.

    Code (CSharp):
    1. using System;
    2. using System.Runtime.InteropServices;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class GetWindowsKeyboardLayout : MonoBehaviour
    7. {
    8. #if (UNITY_STANDALONE_WIN && !UNITY_EDITOR) || UNITY_EDITOR_WIN
    9.     [DllImport("user32.dll", EntryPoint = "GetKeyboardLayout", CallingConvention = CallingConvention.StdCall)]
    10.     public static extern IntPtr GetKeyboardLayout(
    11.         int idThread
    12.     );
    13.  
    14.     [DllImport("user32.dll", EntryPoint = "GetKeyboardLayoutNameW", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
    15.     public static extern bool GetKeyboardLayoutNameW(
    16.         IntPtr pwszKLID
    17.     );
    18.  
    19.     static int[] keyboardIdentifierValues;
    20.  
    21.     static GetWindowsKeyboardLayout() {
    22.         keyboardIdentifierValues = (int[])Enum.GetValues(typeof(KeyboardIdentifier));
    23.     }
    24.  
    25.     void Awake()
    26.     {
    27.         Debug.Log("Keyboard layout is " + GetCurrentKeyboardLayout());
    28.     }
    29.  
    30.     private static KeyboardIdentifier GetCurrentKeyboardLayout() {
    31.         // Gets the keyboard layout only once after it changes and caches it to avoid memory allocations from string marshalling
    32.         IntPtr keyboardLayoutHandle = GetKeyboardLayout(0);
    33.         byte[] b = new byte[128];
    34.         GCHandle h = GCHandle.Alloc(b, GCHandleType.Pinned);
    35.         GetKeyboardLayoutNameW(h.AddrOfPinnedObject());
    36.         string s = Marshal.PtrToStringUni(h.AddrOfPinnedObject());
    37.         h.Free();
    38.         Debug.Log("GetKeyboardLayoutNameW returned: " + s);
    39.         int value = -1;
    40.         KeyboardIdentifier identifier = KeyboardIdentifier.United_States_English;
    41.         if (int.TryParse(s, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out value)) {
    42.             Debug.Log("Successfully parsed keyboard layout string. Value: 0x" + value.ToString("X2"));
    43.  
    44.             bool found = false;
    45.  
    46.             for(int i = 0; i < keyboardIdentifierValues.Length; i++) {
    47.                 if(keyboardIdentifierValues[i] == value) {
    48.                     identifier = (KeyboardIdentifier)keyboardIdentifierValues[i];
    49.                     Debug.Log("Found identifier for layout id: " + identifier);
    50.                     found = true;
    51.                     break;
    52.                 }
    53.             }
    54.             if (!found) {
    55.                 Debug.LogError("No keyboard identifier found for keyboard layout: 0x" + value.ToString("X2"));
    56.             }
    57.         } else {
    58.             Debug.LogError("Failed to parse keyboard layout string: " + s);
    59.         }
    60.         return identifier;
    61.     }
    62.  
    63.     public enum KeyboardIdentifier {
    64.         Albanian = 0x0000041c,
    65.         Arabic_101 = 0x00000401,
    66.         Arabic_102 = 0x00010401,
    67.         Arabic_102_AZERTY = 0x00020401,
    68.         Armenian_Eastern = 0x0000042b,
    69.         Armenian_Phonetic = 0x0002042b,
    70.         Armenian_Typewriter = 0x0003042b,
    71.         Armenian_Western = 0x0001042b,
    72.         Assamese_Inscript = 0x0000044d,
    73.         Azerbaijani_Standard = 0x0001042c,
    74.         Azerbaijani_Cyrillic = 0x0000082c,
    75.         Azerbaijani_Latin = 0x0000042c,
    76.         Bashkir = 0x0000046d,
    77.         Belarusian = 0x00000423,
    78.         Belgian_Comma = 0x0001080c,
    79.         Belgian_Period = 0x00000813,
    80.         Belgian_French = 0x0000080c,
    81.         Bangla_Bangladesh = 0x00000445,
    82.         Bangla_India = 0x00020445,
    83.         Bangla_India_Legacy = 0x00010445,
    84.         Bosnian_Cyrillic = 0x0000201a,
    85.         Buginese = 0x000b0c00,
    86.         Bulgarian = 0x0030402,
    87.         Bulgarian_Latin = 0x00010402,
    88.         Bulgarian_phonetic_layout = 0x00020402,
    89.         Bulgarian_phonetic_traditional = 0x00040402,
    90.         Bulgarian_Typewriter = 0x00000402,
    91.         Canadian_French = 0x00001009,
    92.         Canadian_French_Legacy = 0x00000c0c,
    93.         Canadian_Multilingual_Standard = 0x00011009,
    94.         Central_Atlas_Tamazight = 0x0000085f,
    95.         Central_Kurdish = 0x00000429,
    96.         Cherokee_Nation = 0x0000045c,
    97.         Cherokee_Nation_Phonetic = 0x0001045c,
    98.         Chinese_Simplified_US_Keyboard = 0x00000804,
    99.         Chinese_Traditional_US_Keyboard = 0x00000404,
    100.         Chinese_Traditional, _Hong_Kong_S_A_R_ = 0x00000c04,
    101.         Chinese_Traditional_Macao_S_A_R__US_Keyboard = 0x00001404,
    102.         Chinese_Simplified, _Singapore_US_keyboard = 0x00001004,
    103.         Croatian = 0x0000041a,
    104.         Czech = 0x00000405,
    105.         Czech_QWERTY = 0x00010405,
    106.         Czech_Programmers = 0x00020405,
    107.         Danish = 0x00000406,
    108.         DevanagariINSCRIPT = 0x00000439,
    109.         Divehi_Phonetic = 0x00000465,
    110.         Divehi_Typewriter = 0x00010465,
    111.         Dutch = 0x00000413,
    112.         Dzongkha = 0x00000C51,
    113.         Estonian = 0x00000425,
    114.         Faeroese = 0x00000438,
    115.         Finnish = 0x0000040b,
    116.         Finnish_with_Sami = 0x0001083b,
    117.         French = 0x0000040c,
    118.         Futhark = 0x00120c00,
    119.         Georgian = 0x00000437,
    120.         Georgian_Ergonomic = 0x00020437,
    121.         Georgian_QWERTY = 0x00010437,
    122.         Georgian_Ministry_of_Education_and_Science_Schools = 0x00030437,
    123.         Georgian_Old_Alphabets = 0x00040437,
    124.         German = 0x00000407,
    125.         German_IBM = 0x00010407,
    126.         Gothic = 0x000c0c00,
    127.         Greek = 0x00000408,
    128.         Greek_220 = 0x00010408,
    129.         Greek_220_Latin = 0x00030408,
    130.         Greek_319 = 0x00020408,
    131.         Greek_319_Latin = 0x00040408,
    132.         Greek_Latin = 0x00050408,
    133.         Greek_Polytonic = 0x00060408,
    134.         Greenlandic = 0x0000046f,
    135.         Guarani = 0x00000474,
    136.         Gujarati = 0x00000447,
    137.         Hausa = 0x00000468,
    138.         Hebrew = 0x0000040d,
    139.         Hindi_Traditional = 0x00010439,
    140.         Hungarian = 0x0000040e,
    141.         Hungarian_101key = 0x0001040e,
    142.         Icelandic = 0x0000040f,
    143.         Igbo = 0x00000470,
    144.         India = 0x000004009,
    145.         Inuktitut_Latin = 0x0000085d,
    146.         Inuktitut_Naqittaut = 0x0001045d,
    147.         Irish = 0x00001809,
    148.         Italian = 0x00000410,
    149.         Italian_142 = 0x00010410,
    150.         Japanese = 0x00000411,
    151.         Javanese = 0x00110c00,
    152.         Kannada = 0x0000044b,
    153.         Kazakh = 0x0000043f,
    154.         Khmer = 0x00000453,
    155.         Khmer_NIDA = 0x00010453,
    156.         Korean = 0x00000412,
    157.         Kyrgyz_Cyrillic = 0x00000440,
    158.         Lao = 0x00000454,
    159.         Latin_American = 0x0000080a,
    160.         Latvian_Standard = 0x00020426,
    161.         Latvian_Legacy = 0x00010426,
    162.         Lisu_Basic = 0x00070c00,
    163.         Lisu_Standard = 0x00080c00,
    164.         Lithuanian = 0x00010427,
    165.         Lithuanian_IBM = 0x00000427,
    166.         Lithuanian_Standard = 0x00020427,
    167.         Luxembourgish = 0x0000046e,
    168.         Macedonia_FYROM = 0x0000042f,
    169.         Macedonia_FYROM_Standard = 0x0001042f,
    170.         Malayalam = 0x0000044c,
    171.         Maltese_47Key = 0x0000043a,
    172.         Maltese_48key = 0x0001043a,
    173.         Maori = 0x00000481,
    174.         Marathi = 0x0000044e,
    175.         Mongolian_Mongolian_Script_Legacy = 0x00000850,
    176.         Mongolian_Mongolian_Script_Standard = 0x00020850,
    177.         Mongolian_Cyrillic = 0x00000450,
    178.         Myanmar = 0x00010c00,
    179.         N_ko = 0x00090c00,
    180.         Nepali = 0x00000461,
    181.         New_Tai_Lue = 0x00020c00,
    182.         Norwegian = 0x00000414,
    183.         Norwegian_with_Sami = 0x0000043b,
    184.         Odia = 0x00000448,
    185.         Ol_Chiki = 0x000d0c00,
    186.         Old_Italic = 0x000f0c00,
    187.         Osmanya = 0x000e0c00,
    188.         Pashto_Afghanistan = 0x00000463,
    189.         Persian = 0x00000429,
    190.         Persian_Standard = 0x00050429,
    191.         Phagspa = 0x000a0c00,
    192.         Polish_214 = 0x00010415,
    193.         Polish_Programmers = 0x00000415,
    194.         Portuguese = 0x00000816,
    195.         Portuguese_Brazilian_ABNT = 0x00000416,
    196.         Portuguese_Brazilian_ABNT2 = 0x00010416,
    197.         Punjabi = 0x00000446,
    198.         Romanian_Legacy = 0x00000418,
    199.         Romanian_Programmers = 0x00020418,
    200.         Romanian_Standard = 0x00010418,
    201.         Russian = 0x00000419,
    202.         Russian_Mnemonic = 0x00020419,
    203.         Russian_Typewriter = 0x00010419,
    204.         Sakha = 0x00000485,
    205.         Sami_Extended_FinlandSweden = 0x0002083b,
    206.         Sami_Extended_Norway = 0x0001043b,
    207.         Scottish_Gaelic = 0x00011809,
    208.         Serbian_Cyrillic = 0x00000c1a,
    209.         Serbian_Latin = 0x0000081a,
    210.         Sesotho_sa_Leboa = 0x0000046c,
    211.         Setswana = 0x00000432,
    212.         Sinhala = 0x0000045b,
    213.         Sinhala_wij_9 = 0x0001045b,
    214.         Slovak = 0x0000041b,
    215.         Slovak_QWERTY = 0x0001041b,
    216.         Slovenian = 0x00000424,
    217.         Sora = 0x00100c00,
    218.         Sorbian_Extended = 0x0001042e,
    219.         Sorbian_Standard = 0x0002042e,
    220.         Sorbian_Standard_Legacy = 0x0000042e,
    221.         Spanish = 0x0000040a,
    222.         Spanish_Variation = 0x0001040a,
    223.         Swedish = 0x0000041d,
    224.         Swedish_with_Sami = 0x0000083b,
    225.         Swiss_French = 0x0000100c,
    226.         Swiss_German = 0x00000807,
    227.         Syriac = 0x0000045a,
    228.         Syriac_Phonetic = 0x0001045a,
    229.         Tai_Le = 0x00030c00,
    230.         Tajik = 0x00000428,
    231.         Tamil = 0x00000449,
    232.         Tatar = 0x00010444,
    233.         Tatar_Legacy = 0x00000444,
    234.         Telugu = 0x0000044a,
    235.         Thai_Kedmanee = 0x0000041e,
    236.         Thai_Kedmanee_nonShiftLock = 0x0002041e,
    237.         Thai_Pattachote = 0x0001041e,
    238.         Thai_Pattachote_nonShiftLock = 0x0003041e,
    239.         Tibetan_PRC_Standard = 0x00010451,
    240.         Tibetan_PRC_Legacy = 0x00000451,
    241.         Tifinagh_Basic = 0x00050c00,
    242.         Tifinagh_Full = 0x00060c00,
    243.         Turkish_F = 0x0001041f,
    244.         Turkish_Q = 0x0000041f,
    245.         Turkmen = 0x00000442,
    246.         Ukrainian = 0x00000422,
    247.         Ukrainian_Enhanced = 0x00020422,
    248.         United_Kingdom = 0x00000809,
    249.         United_Kingdom_Extended = 0x00000452,
    250.         United_States_Dvorak = 0x00010409,
    251.         United_States_International = 0x00020409,
    252.         United_StatesDvorak_for_left_hand = 0x00030409,
    253.         United_StatesDvorak_for_right_hand = 0x00040409,
    254.         United_States_English = 0x00000409,
    255.         Urdu = 0x00000420,
    256.         Uyghur = 0x00010480,
    257.         Uyghur_Legacy = 0x00000480,
    258.         Uzbek_Cyrillic = 0x00000843,
    259.         Vietnamese = 0x0000042a,
    260.         Wolof = 0x00000488,
    261.         Yakut = 0x00000485,
    262.         Yoruba = 0x0000046a
    263.     }
    264. #endif
    265. }
    266.  
     
  24. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    443
    upload_2022-10-9_23-42-22.png

    Also, I disabled native keyboard mode and was able to bind the key successfully.

    (Sorry for delay; dinner etc kept me away :) )

    EDIT: Missed your other questions. I'm using UK English and my Rewired version reports itself as 1.1.43.0.U2021

    EDIT: To clarify what's going on: If I open the Rewired Editor, click on Keyboard Maps, add an element, click 'Poll for Key Press' and then press the '/@ key (to the right of semicolon, two keys to the right of L), Rewired displays... gah; will paste in a new reply
     
    Last edited: Oct 9, 2022
  25. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    443
    upload_2022-10-9_23-52-14.png

    NB: It displays this regardless of whether Native Keyboard is enabled or not when I poll for keypresses. The only difference is that at runtime, it works if Native Keyboard is disabled.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Okay, now I understand what's going on....

    Rewired is working as expected. The reason why it appears to be working when you disable native input is because Unity 2021 and all previous versions map the Quote key to Backquote on the UK keyboard layout. Because you've mapped Run to Backquote in the editor, pressing the Quote key on your UK keyboard at runtime works because Unity is incorrectly reporting the Quote key as Backquote. Your mapping is Run -> KeyCode.Backquote. That is the real issue. You are mapping to the Backquote key in the Rewired Editor, not the Quote key. And the reason for this is that the Rewired editor does not use Rewired's input system for polling for key bindings. It uses Unity's OnGUI Event.current.keyCode functionality to get the key you're pressing. Presumably internally this uses UnityEngine.Input. Rewired does not run in the Unity Editor except in Play mode or when Play in Edit Mode is enabled, and therefore cannot be used for polling input when in the Rewired editor.

    You need to map the Run Action to Quote manually and then using Rewired's native keyboard handling will work at runtime.

    If you were using Unity 2022, the Rewired Editor would detect Quote for this key instead of Backquote because Unity changed how their system maps this key on the UK layout in Unity 2022 based on my testing above.
     
    Last edited: Oct 10, 2022
  27. Peeling

    Peeling

    Joined:
    Nov 10, 2013
    Posts:
    443
    Cool; now I get it. So had I got as far as implementing the key remapping in-game, I would have been able to map the key and not noticed a problem.

    Thanks for the explanation!
     
  28. Guitoon

    Guitoon

    Joined:
    May 1, 2019
    Posts:
    6
    Hi ! I found in there is a PlayerIdProperty and a ActionIdProperty attribute to show in inspector the labels of the ID for players and Action in Rewired. And this is very cool !

    Is there any same thing for Map Categories for now ? I want to show it in the same way to enable/disable the selected map.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No. Only Action Id and Player Id exist.
     
  30. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    So was it pretty much a dead end getting Rewired to work with the new input system in Unity 2020.3 LTS? We weren't shifting to 2021 LTS yet because of issues we had with it. We don't really need the new input system, but OpenXR requires it.
     
  31. Gargi

    Gargi

    Joined:
    Jun 6, 2012
    Posts:
    26
    Hi

    Unity 2021.3.11
    Rewired 1.1.43.0.U2021

    Rewired produces 32 Byte Garbage. Not in every frame. Only sometimes. The screenshot is from a Debug Build with the external profiler. Deep Profiler is enabled. VSync is disabled. It seems, that the 'possible' bug is somewhere deep.
    I did not something like Rebinding or anything else. The project is just running.

    Any ideas?

    upload_2022-10-14_23-42-27.png

    Normally i am getting 0 Bytes Garbage in the whole project.
    upload_2022-10-14_23-44-59.png
     
    Last edited: Oct 14, 2022
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I don't see any information about what problems you had or what you tried to do to solve them.

    Set Unity's Active Input Handling setting to "Both".

    Rewired cannot use Unity's input system as an input source if that's what you're trying to do.

    https://guavaman.com/projects/rewired/docs/KnownIssues.html#not-compatible-unity-new-input-system

    Rewired can run along side it. It cannot utilize it in any way. You can use it to feed values into A Custom Controller if you want though.
     
    Last edited: Oct 15, 2022
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    First, it's quite difficult to look into an issue like this without any information about the target platform, the input sources in use, the other platform settings, or any devices being used. I assumed the default of Windows Standalone, Raw Input, XInput enabled, and all other default settings and was correct.

    This is an artifact of a required workaround because of Steam's bugs. Many years ago, I was forced to implement polling on a timer to check whether XInput devices were present or not because Steam does not generate a Windows device connection/disconnection event when a Steam-controlled virtual XInput device is added or removed by Steam. The failure of Steam to generate these device events means I have no choice but to poll. Rewired polls every 1 second on a separate thread for this information if Use XInput is enabled. But the interesting thing is that I am not seeing garbage generated by this function in the Unity editor. The other interesting thing is there is nothing in the function that is being called that would ever generate any garbage except on the first time it was called, not subsequent times.

    Similarly, if the input source is set to UnityEngine.Input, Rewired has no choice but to poll UnityEngine.GetJoystickNames periodically to watch for joystick changes. There's no way to do this without generating a small amount of garbage.
     
    Last edited: Oct 15, 2022
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    @Gargi

    Investigating more:
    1. It can be reproduced in Unity 2021.3.11 in both Mono and IL2CPP Debug builds with Deep Profiling enabled.
    2. It cannot be reproduced in the Unity 2021.3.11 editor.
    3. It cannot be reproduced in Unity 2021.0.1 builds even though the Rewired libraries are exactly the same ones.
    4. I have inserted logging code to verify this function is only getting past the initialization checks on the first execution on initialization of Rewired. It is. The code in that function never reaches a point where any objects could be created at any time after the first execution of this function.

    This is the exact code of the function:

    Code (csharp):
    1. private bool Initialize() {
    2.     if(_initError) return false;
    3.     if(_stopPending) return false;
    4.     if(_isRunning) return true;
    5.     if(_thread != null) return true;
    6.     try {
    7.         ManualResetEvent startResetEvent = new ManualResetEvent(false);
    8.         _thread = new Thread(() => { startResetEvent.Set(); ThreadUpdate(); });
    9.         _thread.Start();
    10.         startResetEvent.WaitOne();
    11.         return true;
    12.     } catch(Exception ex) {
    13.         Logger.LogError("An exception occurred trying to initialize the thread pool.\n" + ex, true);
    14.         _thread = null;
    15.         _initError = true;
    16.         return false;
    17.     }
    18. }
    It never gets past line 4 after the first time it is called and therefore generates no garbage.

    The only explanation I can imagine is Unity's debug builds are generating extra code. My suspicion is that the lambda is being created even though the code never reaches this point. This is not a bug in my code, but an artifact of something Unity's debug build is doing for house keeping. It's not possible to know whether or not this happens in a release build. But either way, Unity is generating the garbage, not Rewired. And they changed something between Unity 2021.0.1 and 2021.3.11 that is causing it.
     
    Last edited: Oct 15, 2022
  35. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    I just wanted to stop by and say wow - amazing asset. I'm not often jaw-droppingly impressed by things, but with just the single day it's been (roughly) since picking this up, between experimenting in empty project along with the great quick start and extensive docs, reading over features and about all the extras, this is absolutely outstanding work. Well done.
     
    guavaman likes this.
  36. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    I am having issues getting the installer to complete. It does not seem to be able to make changes to inputassset maybe.
    I have the file checked out in version control.

    I have also been searching but haven't been able to find an answer.
    Is rewired compatible with the new input package? Could this cause the issue?

    Error seem pretty generic. Not sure why it says platform none. Its set to Windows/Mac/Linux in the build settings.

    Code (CSharp):
    1.  
    2. Rewired: An error occurred!
    3. ------- Rewired System Info -------
    4. Unity version: 2022.1.19f1
    5. Rewired version: 1.1.43.0.U2022
    6. Platform: Unknown
    7. Using Unity input: False
    8. UnityEngine.Logger:LogError (string,object)
    9. Rewired.Logger:LogErrorNow (object,bool)
    10. Rewired.Logger:LogError (object,bool)
    11. Rewired.Logger:LogError (object)
    12. Rewired.Editor.Installer:tsCChWgtpOnXDiTivkKIjoAnOgzrA ()
    13. Rewired.Editor.Installer:IRTvPjKDjWwawIcGoItMMPZaQFtl (Rewired.Editor.Installer/InstallOptions)
    14. Rewired.Editor.Installer:Install (bool,Rewired.Editor.Installer/InstallOptions)
    15. Rewired.Editor.MenuItems:Window_RunInstall ()
    16.  
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Set Unity's Active Input Handling setting to "Both". If it's set to Input System the Input Manager asset what contains these settings is not available.

    https://guavaman.com/projects/rewired/docs/KnownIssues.html#not-compatible-unity-new-input-system
     
  38. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Thanks not sure how that was not coming up. But it says issues with windows standalone.Is that still the case?

    So I tried both. I removed the new input package.
    I deleted that input asset.
    Tried doing clean install of rewired.
    And I still can't get the setup to complete without that same.
    Code (CSharp):
    1. Rewired: An error occurred!
    2. ------- Rewired System Info -------
    3. Unity version: 2022.1.19f1
    4. Rewired version: 1.1.43.0.U2022
    5. Platform: Windows
    6. Editor Platform: Windows
    7. Using Unity input: False
    8.  
    9. UnityEngine.Logger:LogError (string,object)
    10. Rewired.Logger:LogErrorNow (object,bool)
    11. Rewired.Logger:LogError (object,bool)
    12. Rewired.Logger:LogError (object)
    13. Rewired.Editor.Installer:tsCChWgtpOnXDiTivkKIjoAnOgzrA ()
    14. Rewired.Editor.Installer:IRTvPjKDjWwawIcGoItMMPZaQFtl (Rewired.Editor.Installer/InstallOptions)
    15. Rewired.Editor.Installer:Install (bool,Rewired.Editor.Installer/InstallOptions)
    16. Rewired.Editor.MenuItems:Window_RunInstall ()
    17.  
     
    Last edited: Oct 16, 2022
  39. GrassWhooper

    GrassWhooper

    Joined:
    Mar 25, 2016
    Posts:
    109
    hey there,
    i noticed that the asset says it supports vibrations for game controllers, is that also cross platform, as in say i have an xbox controller, and i am playing on a linux, will that work as well?
    or if its an xbox controller with an xbox as well

    so is it cross platform for all features or are there some features limited to some paltforms?
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    That was answered in the link I sent you.

    https://guavaman.com/projects/rewired/docs/KnownIssues.html#not-compatible-unity-new-input-system

    Update: As of Unity 2021.2.0f1, Rewired can now work alongside Unity's new input system on Windows. If you need to use both Rewired and Unity's new input system simultaneously, update to Unity 2021.2.0f1+.

    This error can only be thrown if an exception is thrown in this code:

    Code (csharp):
    1.  
    2.   private static int BackupInputManager() {
    3.       try {
    4.           if(!Directory.Exists(EditorManager.absBackupFolderPath)) {
    5.               Directory.CreateDirectory(EditorManager.absBackupFolderPath);
    6.           }
    7.  
    8.           // Copy file to backup
    9.           if(File.Exists(inputManagerPath)) {
    10.               File.Copy(inputManagerPath, backupFilePath, true);
    11.               Logger.Log("" + inputManagerFileName + " was backed up to " + backupFilePath);
    12.           } else {
    13.               Logger.Log("" + inputManagerPath + " was not found so it cannot be backed up.");
    14.           }
    15.  
    16.           return 0;
    17.       } catch {
    18.           Logger.LogError("" + "An error occurred!");
    19.           return -1;
    20.       }
    21.   }
    That means an exception is being thrown by either Directory.CreateDirectory or File.Copy. This means something is on your system that is causing these functions to fail.

    absBackupFolderPath equals:

    Code (csharp):
    1.  
    2. public static string absProjectPath {
    3.     get {
    4.         string[] split = Application.dataPath.Split('/');
    5.         string path = "";
    6.         for(int i = 0; i < split.Length - 1; i++) {
    7.             path += split[i] + "/";
    8.         }
    9.         return path;
    10.     }
    11. }
    12. public static string absBackupFolderPath {
    13.     get {
    14.         return absProjectPath + "RewiredBackup";
    15.     }
    16. }
    That means .Net's file management functions are simply failing on a path provided by Unity's Application.dataPath. I have no idea how this is possible and can only make guesses:

    1. Anti-malware software or something else on your system is locking a file or preventing these file operations.
    2. Your path contains some kind of characters that make .Net's path functions fail.

    I don't have any other ideas.
     
    Last edited: Oct 16, 2022
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    https://guavaman.com/projects/rewired/docs/FAQ.html#force-feedback
     
  42. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    I created an new project and installed rewired. It was able to complete the changes. I then copied this inputmanager.asset to my current project.
    Is there supposed to be changes to this file? I do not see any changes to it.

    With your new information the issue with the installer is that when it was first run my original asset was still in version control (Perforce) so it was marked read only. This was then copied in a readonly state causing later copy attempts to overwrite the backup to fail.

    Would be great if the error could include a little more description. Could of tracked the issue down on my own.
    You could also see about using unity's built in version control code to try and check things out as a bonus incase its setup.

    Even running the install again it completes now but I do not see any new entries added to the asset.
    What should be being added? I am wanting Rewired to work with unity UI. So I thought this was going to add some entries to that file? Or maybe they are already there in the default case so nothing changes?

    Thanks
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired was released when Unity 4.3 was the latest version and still must be compatible with that version as I still update it. I don't go back and rework all my code when Unity releases new technologies such as version control integration. In addition, being locked out of simply copying a file in the Unity project was never a possibility in my mind and as such made no sense for me to create a detailed log about an error that I expected would never occur. This is the first time anyone has ever reported this error in over 8 years.

    Rewired will modify this InputManager.asset file in the second step of the installer where it creates new Input Manager entries. You must allow it to do so by confirming in the dialog box. Whether the file contents change immediately or not I do not know. That depends on when Unity commits the changes and actually saves the serialized data to disk. If you Press Play with a Rewired Input Manager in the scene and Unity doesn't start throwing exceptions, it worked.
     
    Last edited: Oct 16, 2022
  44. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Only giving some feedback as a first time user.
    A simple message as "failed to write backup file" would be enough.
    I see in your code that you do a lot of #if UNITY_someversion so something like this could be used to gate the version control code.

    I am not getting any errors when starting up. So I assume it must be working. But there are no changes even after restarting. So I can only guess the required entries are there by default now in the unity 2022? Is there a list I can verify against?
    Having some issues but I am trying to go through all your documentation and trouble shooting on setting it up correctly. Before asking more questions.
     
    Last edited: Oct 16, 2022
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired is almost entirely made up of DLLs. DLLs do not have access to Unity's version #if defines. The #if defines in Rewired's DLL are based on custom defines in my DLL project for the 8 major versions versions of Unity rewired supports. These defines can only support feature changes that take place at major versions of Unity, even though they frequently make breaking changes in minor updates. Many times, I have to handle that through ugly reflection. I already have plenty of version specific code in my code base. But the real point is, I am not interested in going back and implementing Unity version control support in all the editor code that I wrote 8 years ago and dealing with trying to support all the versions of it Unity has had over however many years of updates since they added support for it. I've been doing this for a long time and know Unity loves making breaking changes to things over time as they figure out what they really wanted in the first place. That would require testing over at least 8 major Unity releases, but that wouldn't even cover .2, 3, .4 updates. Besides, nothing like this has ever come up as an issue before now, so the value of the feature I would consider negligible. I have a gigantic list of feature requests and features I want to add that I do not have time enough to get to. If support for Unity version control were on the list, it would be an extremely low priority, as nobody else has ever had an issue with it, and I would likely never get to it anyway.

    Rewired adds almost 400 Unity Input Manager entries, none of which are included in Unity's default input manager. If Rewired could not add these entries to the file, it would have thrown an error. Unity would also be throwing constant exceptions every time you press Play. It would not fail quietly. Unity throws an exception every time you try to call Input.GetAxis on a non-existent axis.

    If you disable Native Input in the Rewired Input Manager settings, Rewired will use UnityEngine.Input for all input and cannot function in any way without those input manager entries. You would be seeing a giant spam of exceptions from Unity telling you input manager axis does not exist.

    https://guavaman.com/projects/rewir...tml#exception-input-manager-entries-not-setup
     
    Last edited: Oct 17, 2022
  46. qazwsx2498

    qazwsx2498

    Joined:
    Oct 17, 2022
    Posts:
    13
    When I use the Xbox to connect to the computer, "Left Stick X" in the joystick map is bound to Acion "joystick x", and "Mouse Horizontal" in the mouse map is bound to Acion "mouse x", but when I move the X axis of the left stick or move the mouse horizontally, "Mouse x" is triggered, and "joystick x" never triggers, looking at it on the debug panel It's strange that when I move the x-axis of the joystick, it triggers the mouse to move the input value horizontally. Another point, the same code, only this computer is wrong, the other two computers are correct, the x-axis movement of the joystick triggers the x-value of the joystick, and the horizontal movement of the mouse triggers the x-value of the mouse, is it a device problem?
     
  47. jmgek

    jmgek

    Joined:
    Dec 9, 2012
    Posts:
    177
    I followed the documents suggestions on creating a unknown ui map for touch controls, do I just append it (with the other joystick mapping) to the player? Like the third image?




     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Steam is the only thing that could possibly make that happen. Read this documentation:

    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#steam
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    If you want a Controller Map to be loaded in the Player on Start, you must add it to the list of Controller Maps in the Player. If you don't, it won't be loaded and it won't do anything.
     
  50. waltercl

    waltercl

    Joined:
    Dec 30, 2018
    Posts:
    47
    Could someone who is running the latest version of Rewired in their current Game Project do a quick test.

    I am running an older version, and I'm having an issue where if I go into the Control Mapper and change the Invert Setting for the Mouse Vertical it will not save once I click the Done button. The only way I can get this change to save is I have to change something else like assign a new key to a function or at least click on a different key and then let the timer run out without actually changing anything. But if I only touch the Invert setting (the rounded arrows next to Mouse Vertical for example) and then click Done, my change won't save.

    Guavaman has asked me to upgrade to the latest, but if someone who is on the latest is also having this issue then I don't want to go through the upgrade. My Package Manager is reporting that I've downloaded the latest version (1.1.43.0 (Current) - released on August 21, 2022) but when I import that it doesn't change anything and then when I check the Help->About it is still reporting that I'm on the old version of Rewired.

    So if someone could launch their game and then try and change ONLY the invert setting and let me know the result, I'd really appreciate it.

    If I do need to upgrade then I'll probably end up having to delete my current Rewired Folder and re-import but then I've got to set up all my actions, maps, etc. again.