Search Unity

Rewired - Advanced Input for Unity

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

  1. Jayme65

    Jayme65

    Joined:
    Dec 11, 2016
    Posts:
    94
    My game (simulation) is 1 player only...but would need more than one controller to get input from.
    Is this possible to achieve? How would I have to proceed to use 2 controllers for 1 player, for instance? (..and working with Control Mapper)
    Thanks you very much!!
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Control Mapper already has a language system to allow you to change titles of all the various buttons and headings except for Actions, Controller elements, and other data from the Rewired Input Manager.

    https://guavaman.com/projects/rewired/docs/ControlMapper.html#language

    If you want to translate the other content, the easiest way would be to modify the code everywhere a string name is obtained from Rewired and pass that through a translation function.
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Assigning multiple controllers to a Player is one of the most basic features of Rewired. That's really the entire purpose of the Player-Action system -- so you can query for Action values without caring what controller(s) that value came from.

    See Max Joysticks per Player if using Joystick Auto Assignment:
    https://guavaman.com/projects/rewired/docs/RewiredEditor.html#settings-joystick-auto-assignment

    See Control Mapper inspector- Controller Input Field Count:
    https://guavaman.com/projects/rewired/docs/ControlMapper.html#inspector-controller-options
     
  4. Djaydino

    Djaydino

    Joined:
    Aug 19, 2012
    Posts:
    48
    Hi.
    I am already using the language system and i already modified the code (i explained that on my previous post...)

    My question is :
    Where in the ControlMapper.cs or ControlMapper_Classes.cs it would be best to place a event for when a Controller elements is changed.
    OR
    or the part where the Controller elements are created so i can add a component to handle change.
     
  5. Jayme65

    Jayme65

    Joined:
    Dec 11, 2016
    Posts:
    94
    So, I'm using 2 joysticks per 1 player. I understand that
    Code (CSharp):
    1. player.controllers.maps.LoadDefaultMaps(selectedControllerType);
    will reset the map to default...for every joystick.
    Is there any way or workaround to reset the map for one joystick, based on its controllerId (Joystick.id) for instance?
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I didn't see you said anything about using the Language system and the code change you said you made was a roundabout method of finding TMPText components in GameObjects. I'm suggesting that that's an inefficient way to do it. It would be more efficient to simply change the code where those fields are written and make it call out to some static translation class to achieve the same thing.

    There are no events for you to trigger off of in order to detect changes. This code was written many years ago, and just like you, I have to manually dig through the thousands of lines of code to find where something is done and familiarize myself with all of it to tell you where and how to do things. Telling you how and where to make code changes to things is something I do not provide support for. Control Mapper is intended to be a drop-in-and-use system for those who don't have the experience or time to make their own system. Helping you make an advanced customization of it isn't a part of the free support services I provide. There are literally several dozen places in code across 3 files that have to be changed in order to support localization of Rewired Input Manager objects (Actions, Map Categories, Layouts, Players, Controller names, element identifiers, keyboard key modifiers, etc.) It's faster if I just change it myself.

    I have overhauled the system to support translation of all strings. You will find the attached zip file. This updated version has a framework for translating all the Rewired elements, but it does not provide a way to store the translation data for the Rewired elements. You will have to provide that part in an extended class. This merely provides an interface for Control Mapper to call into for all strings.

    You will have to extend the LanguageDataBase class and extend it in order to plug in your translation and override each function pertaining to translation of Rewired core item names. Copy LanguageData.cs, rename it to something, and modify all the functions below line 256 to translate the elements you want to translate using whatever system you have set up for that. You will then have to make a ScriptableObject instance of your new extended class, then attach that to Control Mapper in the inspector so it uses it instead of the default language object.
     

    Attached Files:

    Last edited: Apr 19, 2020
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    No there isn't.

    The only way you can do it is to clear them and manually load the ones you want.

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

    https://guavaman.com/projects/rewir...Player_ControllerHelper_MapHelper_LoadMap.htm
     
  8. Jayme65

    Jayme65

    Joined:
    Dec 11, 2016
    Posts:
    94
    One last think if you don't mind (and thanks for your constant help until then)
    Now that I've done this
    Code (CSharp):
    1. player.controllers.maps.ClearMapsForController(selectedControllerType, selectedControllerId, false);
    2. player.controllers.maps.LoadMap(selectedControllerType, selectedControllerId, "Default", "Default");
    ...a controller can be individually reset successfully...but once I 'reset', the navigation is not possible anymore! If I reset the keyboard that way for instance (but the same is true for other controllers), the cursor keys (which are part of the map) don't trigger the action anymore (by the way the Horizontal Axix, Vertical Axis, Submit Button, Cancel Button have been attributed in the Rewire Standalone component....I tell in case it would be of interest)
    Thanks again
     
    Last edited: Apr 18, 2020
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    RewiredStandaloneInputModule doesn't care about controller maps. All it cares about is getting the value of the Action from the Player. The Player completely encapsulates all Controller Map functionality. If it has a Controller map that maps those Actions and that Controller Map is enabled, it will work.

    See the documentation of the second method you called:
    https://guavaman.com/projects/rewir...Player_ControllerHelper_MapHelper_LoadMap.htm

    Loads a controller map from the maps defined in the Rewired Editor. Replaces if a map already exists with the same category and layout. When replaced, map enabled state is copied from the existing map into the replacement. Otherwise, map starts disabled and must be enabled before it can contribute to input. If enabled is set to true and rules exist that apply to the map, the enabled state will be set based on those settings.

    The Controller Maps are loaded but disabled, therefore not contributing to any input.

    Use this overload and pass true:
    https://guavaman.com/projects/rewir...ayer_ControllerHelper_MapHelper_LoadMap_3.htm

    Or skip clearing the maps first and just load them over the existing ones replacing them and leaving the same enabled state.

    The single best way to debug any problem in Rewired like this is to use this:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information
     
    Last edited: Apr 19, 2020
  10. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    Hey @guavaman got a request. I am looking at the dolphin bar to sync Nintendo Wii remotes via it's builtin bluetooth adapter with desktop PC's it also acts as an IR sensor bar. It makes the Nintendo Wii remote look like a USB device that Windows can recognize and use. Anyway the request I have would it be possible to support the Nintendo Wii Remote and possibly the nun chuck via the dolphin bar? I know this is a strange request btw.
     
  11. ChickenHero

    ChickenHero

    Joined:
    Jul 18, 2016
    Posts:
    79
    Can Rewired detect the left and right of the tilt wheel?
    I tried MouseWheel and MouseButton3 ~ MouseButton7, but I couldn't find them.
    I searched the manuals and forums, but I don't understand.
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Rewired only supports native mouse input on one platform -- Windows Standalone. All other platforms use UnityEngine.Input for mouse input. UnityEngine.Input does not support the horizontal wheel axis, therefore Rewired does not either. Rewired's mouse input was designed to mirror Unity's exactly in all cases including the number of buttons and axes exposed and what function on the mouse maps to what element. Even though Rewired can detect horizontal mouse wheel movement on Windows when Native Mouse Handling is enabled, it is not exposed so the mouse interface is the same on all platforms.
     
    ChickenHero likes this.
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    How is the device on Windows exposed? Is it a HID joystick or gamepad? If so, you would be able to see the device already in Rewired or Unity because they can both see any HID joystick or gamepad. It would appear as an Unknown Controller in Rewired and could be mapped at run time by the user.
     
    HeadClot88 likes this.
  14. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    This is good to know. I believe it comes in as a controller according to the OS. I would need to double check though. :)
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Just run Rewired/DevTools/JoystickElementIdentifier scene and see if it shows up.
     
    HeadClot88 likes this.
  16. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    Got it will do. I am waiting for the dolphin bar to show up from amazon. But will report back when It arrives and I have tested it :)
     
  17. lemartialou

    lemartialou

    Joined:
    Jul 10, 2015
    Posts:
    16
    Hi, I was looking for the same thing, I did have to search a bit, but it seems to me that this feature is supported by UnityEngine.Input, except not as an input manager axis:

    https://docs.unity3d.com/ScriptReference/Input-mouseScrollDelta.html

    It can be tested using this little snippet (note: values are unscaled):

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class TestMouseScrollWheel : MonoBehaviour
    4. {
    5.     void Update()
    6.     {  
    7.         // SCROLL WHEEL HORIZONTAL INPUT
    8.      
    9.         if (Input.mouseScrollDelta.x != 0f)
    10.         {
    11.             Debug.Log("[mouseScrollDelta.x: " + Input.mouseScrollDelta.x + "]");
    12.         }
    13.      
    14.         // SCROLL WHEEL VERTICAL INPUT
    15.      
    16.         if (Input.mouseScrollDelta.y != 0f)
    17.         {
    18.             Debug.Log("[mouseScrollDelta.y: " + Input.mouseScrollDelta.y + "]");
    19.         }
    20.     }
    21. }
    With this code I can have access to:
    - the touchpad's horizontal scroll input on my laptop
    - the horizontal scroll wheel on my logitech mx master mouse

    Can't this be used? It would be sooo nice to have this feature implemented in Rewired :)
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    It can't be used without changes to Rewired. Rewired does not expose the horizontal scroll wheel axis. The structure of Mouse and Mouse Map have to me changed to support this so Actions can be bound to horizontal wheel which will likely cause some breaking issues for people and issues when loading saved maps.
     
    Last edited: Apr 20, 2020
  19. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    hello Augie,

    What I want is to swap the default keys from QWERTY, to AZERTY or QWERTZ. (based on the language selected by the player.)

    I have a lot of issue of figuring out how to do it, this is what I managed to get:

    Code (CSharp):
    1.     public void SetKeyboard()
    2.         {
    3.             int controllerId = 0;
    4.  
    5.             ControllerMap map = InputManager.Instance.InputPlayer.controllers.maps.GetFirstMapInCategory(
    6.                 ControllerType.Keyboard,
    7.                 controllerId,
    8.                 _mappingSets[0].mapCategoryId);
    9.  
    10.             ElementAssignment assignment = new ElementAssignment(
    11.                 KeyCode.A,
    12.                 ModifierKeyFlags.None,
    13.                 RewiredConsts.Action.VERTICAL,
    14.                 Pole.Positive);
    15.  
    16.             if(map.ReplaceOrCreateElementMap(assignment))
    17.             {
    18.                // it works
    19.             }
    20.  
    21.             ReInput.userDataStore.Save();
    22.      
    23.         }
    It kind of work, but on the Control mapper, the new inputs are not visible.

    how can i do it?
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Control Mapper must be closed when you are doing this or you will have to reset it. It does not constantly poll the state of Controller Maps being displayed. If it is closed when you are doing this (properly closed, not just disabled through a parent GameObject), it will load the new mappings the next time it is open.

    Relevant functions:
    ControlMapper.Close();
    ControlMapper.Open();
    ControlMapper.Reset();
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Rewired 1.1.33.0 is available on the Unity Asset Store.

    Please see Updating Rewirede before updating.

    Release Notes:

    1.1.33.0:

    Changes:
    - Internal refactoring that breaks compatibility with Nintendo Switch and Stadia plugins. Plugins must be updated after updating to 1.1.33.0.
    - Added Font Size field to DebugInformation inspector.
    - Control Mapper: Expanded language system to allow for translation Rewired object strings (Player names, Action names, Controller names, Controller element names, etc.).

    Controller Definitions:
    - Windows Fallback: Open VR controller definitions changed to match breaking changes to controller names returned by Unity made in an unknown version of Unity.

    Bug Fixes:
    - Fixed exception thrown by some Keyboard methods when passing new KeyCodes added in later versions of Unity.
    - Fixed bug in Debug Information causing Button Maps foldout to open and close simultaneously across all open Controller Maps.
    - Windows Fallback: Fixed Microsoft Xbox 360 Controller mappings due to undocumented breaking change made in Unity 2018.3 causing both triggers to activate when either trigger is pressed.
    - Control Mapper (Text Mesh Pro): Enabled Auto Size setting on Text Mesh Pro Text components on several static buttons.
     
  22. lemartialou

    lemartialou

    Joined:
    Jul 10, 2015
    Posts:
    16
    I understand this is not implemented in the current version of Rewired, my question was more like: can those changes be made in the future of Rewired? Can this be added as a feature request? Just to be sure what to expect :)

    I also have a question related to keyboard layouts (sorry if it's already been asked but I didn't manage to find any relevant infos in the documentation): is there ANY way to get language layout information from the keyboard?

    2 goals:

    - I'd like to be able to find or define a key based on its physical location.

    - On my french AZERTY keyboard, alphabetic keys are working as expected, I get an "A" and not a "Q", but the special characters are all messed up. For example, bottom right of the keyboard:

    - US Layout gives: M, Comma, Period, Slash
    - FR Layout gives: Comma, Period, Slash, BackQuote
    - FR Layout SHOULD give: Comma, Semicolon, Colon, Exclaim

    Is there any way to work around that? ANY way to get the language layout of the keyboard? Even a hackish one? It seems that the new input system from unity has found a solution to this problem, can this solution be "borrowed"? Is this a feature (keys based on physical location) you consider for the future of Rewired?

    Thanks again for your great support, Rewired is awesome !!! :)
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I understood that as a feature request. Thanks for pointing out that Unity exposed this value at some point in the past. It did not exist in the base version Rewired was developed on -- 4.3.

    No. Exactly like Mouse input, Rewired's keyboard input was designed to be a 1:1 mirror of Unity's keyboard system. There is only one base platform that implements native code for the keyboard -- Windows Standalone. Unity's keyboard system is based on KeyCode and Rewired is as well. The behavior of what keys are reported by Rewired when using non-US keyboards is the same as Unity. This is the exact same problem as with the mouse. While Rewired has access to the Windows API to get more information about the keyboard, it does not expose this because there is no support for any of this across platforms due to the dependence on UnityEngine.Input for keyboard on almost all platforms.

    The idea behind the decision on the mouse and keyboard years ago was that Unity handled them well enough that I didn't need to reinvent the wheel. I know now that was not the case because so many want more advanced functionality like this and other advanced things like multi-keyboard and multi-mouse support. I would need to make gigantic sweeping breaking changes to the system from the bottom to the top to support all of these things the way the current structure is designed and implement native input for keyboard and mouse on every single supported platform.
     
    Last edited: Apr 20, 2020
  24. lemartialou

    lemartialou

    Joined:
    Jul 10, 2015
    Posts:
    16
    Thanks for clarifying everything, keep up the great work ! :)
    Cheers!
     
  25. Djaydino

    Djaydino

    Joined:
    Aug 19, 2012
    Posts:
    48
    Yeah i know its not the best solution, but my c# knowledge is not very good :)
    but extending the LanguageDataBase class i think i can handle thanks for you explanation and the overhauled file.
     
  26. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    Hi - Do you have any information regarding which open source licenses might be in use and require redistribution for games that we're releasing? I've actually baked the entire licenses.txt into my credits section for both PC and XBox builds, but would like to strip it down to whatever is actually getting used per platform. Thanks!
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I don't have information on what is used per-platform. Does Unity provide such a breakdown?

    I spent time to through the list and organized them as best as I could find.

    Editor only:
    DotNetZip
    jzlib
    Rotorz Reorderable List
    SimpleJSON

    OSX Standalone only:
    DDHidLib
    MonoMac

    Windows Standalone only:
    Sharp DX
    HidLibrary

    All Build Targets except Windows UWP, Windows Store:
    Simple DirectMedia Layer library

    All Build Targets:
    Unity open-source code
    Tiny Json

    ???:
    Emscripten

    I honestly have no idea where Emscripten was used. I suspect it's related to WebGL but there are no references to anything that uses it in my code base. I suspect it may have been included as required by some other library.

    As for SDL, none of the code is actually included in Rewired, but SDL2 wrapper classes, extern function calls, and enums are. The libraries are only included if you install them or include them.
     
    Last edited: Apr 20, 2020
    Mark-Davis likes this.
  28. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Heyo. I just tried upgrading my project to 2019.3 from 2019.2 but I'm running into a lot of Rewired input lag in the editor now. Basically my inputs are getting stuck. The longer I hold down a key, the longer it stays on after I release it. This includes mouse movement. Caveat- this has nothing to do with virtual joysticks/axis, I've disabled those and there was no change.

    Things I've tried:
    reinstalling Rewired completely
    restarting Unity both before reinstall and after
    running a build (works fine in a build)

    I'm convinced the issue resides with Rewired (or something further up the chain from that, rather than my own scripts) because upon debugging the actual values in the input manager, you can see the values getting stuck there as well. This is a big project, so its very possible something else could be affecting it, but Rewired seems the likely solution. Is there maybe some step I forgot to do upon upgrading/reinstalling? Any ideas?
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Definitely not Rewired. The exact same code is used on 2019.2 and 2019.3.

    I keep hearing this same story about input lag and "buffering" with Unity's new input system. Disable it if it's enabled:
    https://guavaman.com/projects/rewired/docs/KnownIssues.html#not-compatible-unity-new-input-system

    Unity trying to take control over Raw Input devices at the same time Rewired is doing the same thing is a recipe for disaster. An application is allowed only one single window to receive Raw Input events for a particular device. Unity's new input system uses Raw Input for keyboard and mouse which it did not do in the past and therefore there were no conflicts. Now it does, and the two cannot co-exist.
     
  30. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Doesn't look like the new manager is installed/enabled. It's a package isn't it? This was a straight upgrade from 2019.2
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    The package doesn't have to be installed. The new input system's backend is part of core Unity. If the Active Input Handling mode is not set to "Input Manager", the new input system is running in the background. The package manager stuff is just high-level C# code for handling controller, players, action mapping, etc.
     
  32. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Ah I see the setting now. Unity really loves putting settings in obscure places. Unfortunately it looks like its set to old, legacy Input Manager... damn it. Looks like it's not that easy.

    Maybe I'll try retracing my steps with a brand new project and see if I can get the same issue to appear.
     
    Last edited: Apr 20, 2020
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Sigh... Then this is something completely new. You're not the first one to complain about some kind of input lag / buffering in a recent 2019.3 update. I can't reproduce it in 2019.3.10f1. Rewired does ZERO buffering of anything. It updates all values on Update from data read through the low-level input APIs, sometimes on a different thread, sometimes delivered at the beginning of the update on the same thread. None of this involves buffering or anything that could result in input lag.

    The only possible explanation I can think of for Raw Input to be lagging on keystrokes is that the events are simply not being delivered to the window by Windows when they're supposed to be. If the key down event comes in and is processed, the key will be on. When the key up even comes in, it should be immediately delivered and processed. If this is not happening, that would signify to me the Windows key up event is not being delivered when it is supposed to be. If this is the case, something is catastrophically wrong at a very low level.
     
    Last edited: Apr 20, 2020
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    What happens in a build?
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    When you reinstalled Rewired, did you follow this:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#clean-reinstall

    This is only necessary when Unity corrupts serialized data, which does happen during project upgrades quite often. I can't imagine how serialized data corruption could result in what you're describing though.

    Are Errors and Warnings enabled in the log? Is some error message being spammed causing a slowdown that makes it seem like input lag?

    This input lag issue was also reported on the previous page of this thread and points to a thread about Unity's input system experiencing the same thing:
    https://forum.unity.com/threads/rewired-advanced-input-for-unity.270693/page-123#post-5718721
    https://forum.unity.com/threads/rewired-advanced-input-for-unity.270693/page-123#post-5718724

    I honestly have no clue how some change in Unity could result in Raw Input being unable to deliver its key events in a timely manner.
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Do you happen to be using Fixed Update for input?

    This thread about the new input system having this exact issue was resolved by him disabling input in Fixed Update.
    https://forum.unity.com/threads/mouse-keyboard-input-lag.791523/

    I wonder if there's some new Fixed Update bug going on...
     
  37. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Yep everything works fine in the build. Both in build and editor there are no console errors/warning/logs.

    I actually did just think about how I was using FixedUpdate. I tried disabling it but there didn't see to be any change.

    But I think you're right. This must be a 2019.3 thing, not a rewired thing.
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Did you disable Fixed Update in the Rewired Input Manager when you did this test?
     
  39. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    I did, yes.
    Just in case, after, I also actually tried enabling the new input system, restarting, then disabling it, and restarting again, to see if maybe there was some code being ran but not shown. Still no fix.
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Also, can you send me your /ProjectSettings folder zipped? I would like to see if some random setting you have enabled allows me to reproduce it.
     
  41. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    43
    Sure thing. I'm playing around with a fresh project now and not seeing the issue. I'll keep playing with it on my end as well.
     
  42. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
    Thanks so much for your quick response! That's exactly what I was looking for.
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    For those following the input lag issue with @Janoooba (@RakNet this is relevant to you also):

    After much back and forth with @Janoooba and doing hours of debugging and testing, I have discovered the cause of the issue.

    1. Unity made a change to the editor update thread in 2019.3.8 (https://unity3d.com/unity/whats-new/2019.3.8 - Editor: Fixed the editor application main thread tick timer throttling causing unwanted spikes and delays. (1211383)) that has resulted in this lag in a very roundabout way. Best I can figure, it seems that the Windows message queue is having to wait on the editor GUI thread or something, so heavy CPU usage in the editor GUI update thread now maifests as a severe slowdown to the main thread if messages are waiting to be delivered to it by Raw Input. I could be wrong on the exact mechanics, but the relationship between the GUI update slowdown and the lag of Raw Input messages is definite. This issue persists as of 2019.3.10, the latest version, as of the date of this post.

    2. The more work happening on the editor GUI thread, the worse the slowdown of the main thread will be when it has to wait on a Raw Input event to be delivered.

    3. This affects Raw Input, presumably because Raw Input relies on the Windows messaging queue for delivery of input events.

    4. This is most obvious by having the Rewired Input Manager selected in the inspector with the Debug Information foldout open displaying a lot of fields such as when looking at Controllers -> Keyboards and listing all the keys. With this open, the lag after releasing a key when held down for a second or more while is > 1 second. Debug Information makes a lot of calls to Editor Prefs which slows down the editor thread enough to make the new issue visible. (I can fix this usage of Editor Prefs so it doesn't call it as often in the next update, but this will not "fix" the underlying issue of the Unity editor update being intertwined with the game thread.)

    5. Interestingly enough, this also affects Unity's new input system based on my testing, probably through the exact same mechanism of preventing the Raw Input events from being delivered in a timely manner to the input thread. I was able to reproduce the lag exactly simply by enabling their new input system and running a CPU-intensive operation in an editor script.

    I have reported this bug to Unity with a simple reproduction case using their new input system.
     
    Last edited: Apr 21, 2020
    Cambesa and zKici like this.
  44. dfoxforge

    dfoxforge

    Joined:
    Mar 10, 2020
    Posts:
    4
    Hi,

    Rewired is an absolutely incredible asset! I have worked with it in the past but I remember that there was a forced specific folder structure for the libraries to load everything in. E.g. the project settings folder in assets first layer and the Rewired->Data folder for EditorSettings are compulsory. Has this been made configurable to the developer yet?

    I would like to place my .dlls under specific high level asset directories with respective names for the tools they are part of. I do this with all the filetypes at first level under the main asset directory, e.g. libs-> Rewired, materials -> Rewired, textures -> Rewired, data-> Rewired, prefabs->Rewired etc..

    I want to avoid creating niche cases in my project structure just because a .dll requires to load it in a non-configurable way. Or is there a thread with answer to this already? Could someone point me there?

    Cheers! :)
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    No, you cannot move the DLLs around freely and break up the asset folder structure however you like. This will never be changed. This is the only way I have to detect the structure of the folders in the system while still allowing the user to move the Rewired folder wherever they want in their project. This is absolutely necessary because of the automated management of installation and upgrade of special platform plugins, extras, integrations, and other optional packs. Rewired is a complex system, not just a DLL. I have to have some way of knowing where things are if I am to be able to manage all the assets in this system, and using the DLL as a locator for that is the best way I have found.
     
    dfoxforge likes this.
  46. dfoxforge

    dfoxforge

    Joined:
    Mar 10, 2020
    Posts:
    4
    Makes sense! Thank you for the response. You could possibly create a config scriptable object which simply serializes relative paths which can then be changed by the user (with defaults already defined) - then do a search for this among assets in the .dll and nicely error if invalid or not found. But I fully understand the complexity issue and it's not that simple. Thanks again for the clarification and fast response :)
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Thanks for the suggestion, but honestly, having to re-design and structure my system in such a way to allow it to be taken apart by the user and moved around piece meal is just too much to ask. The automated process I have designed works for nearly everyone without any user interaction required no matter where you move the top-level folder. I have never had anyone else among all the thousands of users who use Rewired ask for the ability to do this. The more of this kind of one-off special use case need I have to work into the design of my system (and I have incorporated many in the past), dictating how things work and having to be maintained forward, the more boxed-in and hand-cuffed I feel my design. Sorry, but I do not want to change my system to have to design around an unknowable folder structure or file locations.

    Having a fixed and knowable structure also allows me to perform cleanup after an upgrade in the case certain files or folders are no longer needed or need to be renamed. This is not possible with the Unitypackage format which just adds files with no ability to remove them, so the code has to be aware of where things are in order to manage them.
     
    Last edited: Apr 21, 2020
    dfoxforge likes this.
  48. dfoxforge

    dfoxforge

    Joined:
    Mar 10, 2020
    Posts:
    4
    Absolutely, I understand this would be a special use case now and not plausible for this scenario. Thank you for the time in explaining and responses!
     
  49. Deepwolf413

    Deepwolf413

    Joined:
    Nov 23, 2012
    Posts:
    57
    Hi, I just wanted to report a bug, not sure if it is intended though.
    When you have an Action and the type is Axis, then you type in something in the positive or negative fields, and then change the type to button again, it will show the axis name on the Map.

    Here's an example:
    Pic1 I show what it looks like when the type is Axis:
    BugPic1.PNG
    Pic2 I have changed it back to type Button:
    BugPic2.PNG
    Pic3 I'm showing what it shows in the Map, even though it's of type Button:
    BugPic3.PNG
    Pic4 is what it looks like when I remove the stuff from the positive field and change it back to type Button again:
    BugFreePic4.PNG
    The last pic is what I believe it should always look like when it's of type Button, no matter what is in the axis fields.
     
  50. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    Hi guavaman,

    Do you have any idea why the mouse input values for various mice would change? I've got some users complaining that the game's mouse sensitivity is through the roof, even at the lowest settings they are unable to look anywhere since 1cm of mouse movement is a 1080 spin for the win.

    This is all on Windows using GetAxisRaw, Mouse XY Axis Mode is MouseAxis, and Mouse XY Axis Sensitivity is 1. I have RawInput selected and the "Use XInput" checkbox, with Native Mouse Handling selected, as well as Enhanced Device Support.

    This is just a single player first person game, nothing crazy going on with the inputs from our end. It works fine on almost everyone's computer, but on some the input values are huge.

    I scale the mouse input using a float (I don't change anything in Rewired), and at its lowest setting the sensitivity can just be 1 (I will lower that more...), so just raw outputs from GetAxisRaw.

    Do you know anything I can try? Perhaps not using Native Mouse Handling or something else I've done wrong?

    Thanks!