Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Rewired - Advanced Input for Unity

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

  1. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    502
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    No. The Rewired Editor database is not modifiable at runtime. There is no public editor API for modifying the contents of the editor.
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    There's a troubleshooting topic on this:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#works-in-editor-not-in-build

    I've never heard of a PointerCanvas. This is not a component of Rewired.

    If your inspector settings in Rewired Input Manager disallow mouse input if touch is supported and you are using a touch-enabled Windows computer, mouse will not function.
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    This is only possible if Unity adds support for it, which I see no evidence of at this point.
     
  5. LeagueOfMonkeys

    LeagueOfMonkeys

    Joined:
    Aug 13, 2012
    Posts:
    33
    Hi,

    I just updated the Rewired plugin to the 1.1.26.0.U2018 version and it has stopped working on the editor (2018.4.1f1) when the target platform is Android. I get the following error in the console:

    Rewired is not initialized! Are you missing a Rewired Input Manager in your scene?

    There is a Rewired Input Manager in the scene and it does work when the target platform is PC.

    Is this something I can have some help with?

    Thanks
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    The error you are reporting has to be coming from Control Mapper or the RewiredStandaloneInputModule, but you didn't post the stack trace so I can't know for sure. The only way this would happen is if there is no Rewired Input Manager in the scene or it is disabled.

    Rewired on Android works the same way as every other platform. There is no special Android code in Rewired that could possibly make this happen. The Rewired Input Manager is initialized before every other script based on the Script Execution Order set by the installer. If this Script Execution Order has been changed, Rewired cannot work as intended.

    Ensure your build scene actually has the Rewired Input Manager in the scene or instantiated in the scene before any other script runs by using the Rewired Initializer. It's a very common error for the build scene to not include the same Rewired Input Manager that you're testing in the editor in another scene. Check the logs for any other messages.
     
  7. LeagueOfMonkeys

    LeagueOfMonkeys

    Joined:
    Aug 13, 2012
    Posts:
    33
    The error comes from the RewiredStandaloneInputModule, the full log is:

    Code (CSharp):
    1. Rewired is not initialized! Are you missing a Rewired Input Manager in your scene?
    2. UnityEngine.Debug:LogError(Object)
    3. Rewired.Integration.UnityUI.RewiredStandaloneInputModule:InitializeRewired() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:1145)
    4. Rewired.Integration.UnityUI.RewiredStandaloneInputModule:Awake() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:560)
    5.  
    The Script Execution Order hasn't been changed, Rewired.InputManager is on top followed by Rewired.Initializer and Rewired.Internal.OnGUIHelper

    Could you explain what the Rewired Initializer is?

    It doesn't matter whether I instantiate the Rewired Input Manager or I have in the scene from the beginning, it doesn't work either way.

    It might be worth mentioning that I also have the plugin folder for the Nintendo Switch, but again it works fine when the target is PC.
     
  8. mmvlad

    mmvlad

    Joined:
    Dec 31, 2014
    Posts:
    98
    I need to modify it in the editor, not runtime.
    I believe that if you are making a professional tool for developers there must be an API to allow this sort of things. Gui-only tools are not developer oriented.

    And what is the point of obfuscating the code of your plugin? It won't stop pro devs as the logic of it is documented and pretty straightforward so it will take a couple of extra hours to deobfuscate it. Also, pro devs will be able to create a similar plugin without the need of looking at your code.
    So the only thing you achieve is making life harder when someone wants to automate working with your plugin or look into the source to find where memory is allocating.
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Rewired Initializer:
    http://guavaman.com/projects/rewired/docs/InputManager.html

    See Using the Rewired Input Manager in your game.

    The log is showing that RewiredStandaloneInputModule:Awake() is running and finding that ReInput.isReady is false. The only possible way this could happen is if there is no enabled Rewired Input Manager in the scene at the time Awake is called on RewiredStandaloneInputModule.

    Rewired.InputManager is set to -32000 script execution order so it is guaranteed to execute its Awake function before any other script in the scene.

    Rewired.Initializer is set to -31999 script execution order so it is guaranteed to execute its Awake function and instantiate the Rewired Input Manager prefab before any other script in the scene can execute.

    Any catastrophic failure to initialize Rewired resulting in ReInput.isReady being false would be logged.

    Therefore, what you are describing cannot be happening based on the script execution order. If you are 100% certain there is an enabled Rewired Input Manager in the scene and the GameObject or Component aren't being disabled by something, then the only thing I can think of is that there is some kind of new error in Unity causing the scripts to respect the script execution order. If that's the case, then there's nothing I can do to make it work because script execution order is critical in making Rewired initialize before other scripts call it.



     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Thanks for the opinion. Rewired is exclusively made for developers. There are countless developer-oriented tools (in Unity and outside Unity) that require you use a GUI.

    If you are unhappy with Rewired, please contact support and request a refund:
    http://guavaman.com/rewired#support
     
  11. LeagueOfMonkeys

    LeagueOfMonkeys

    Joined:
    Aug 13, 2012
    Posts:
    33
    Ok, thanks. I will figure it out.
     
  12. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    Is there an easy way to toggle between QWERTY, DVORAK and AZERTY keyboards with Rewired?
     
    littledwarf likes this.
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    No. Rewired's keyboard support mimics Unity's exactly with no changes.
     
  14. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    Okay. I made a simple system that uses the controller mappings for different keyboard layouts. But as far as I can see there is no way to retrieve the layout name? (only its ID).

    Code (CSharp):
    1. public void EnableKeyboardMap(int index)
    2.     {
    3.         foreach (var controllerMap in _playerInput.controllers.maps.GetMaps(ControllerType.Keyboard, 0))
    4.         {
    5.             Debug.Log(controllerMap.name); // blank?
    6.  
    7.             if (controllerMap.layoutId == index)
    8.                 controllerMap.enabled = true;
    9.         }
    10.     }
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    A Controller Map does not have a name. It has only a Category Id and Layout Id which identify it.

    Debug.Log(ReInput.mapping.GetLayout(ControllerType.Keyboard, controllerMap.layoutId).descriptiveName);

    http://guavaman.com/projects/rewire...M_Rewired_ReInput_MappingHelper_GetLayout.htm
    http://guavaman.com/projects/rewired/docs/api-reference/html/T_Rewired_InputLayout.htm
     
  16. AndyLangberg

    AndyLangberg

    Joined:
    Jul 6, 2018
    Posts:
    37
    Hi,

    Is it a known issue that Unity Event Trigger script breaks the touch pad?
    ie: If you add an image on top of a touch pad, and include an Event Trigger with an PointerClick on the image, the touch pad no longer works (tested on iOS).

    edit: Likewise, I just noticed, if you try to use a IOnPointerClickHandler on a custom script on the image instead, Rewired Touch Pad swallows that event completely, so nothing ends up happening.
     
    Last edited: Jun 25, 2019
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    This is not an issue with the Rewired components. This is how Event Trigger works. See the documentation:
    https://docs.unity3d.com/ScriptReference/EventSystems.EventTrigger.html

    NOTE: Attaching this component to a GameObject will make that object intercept ALL events, and no events will propagate to parent objects.

    The Rewired UI components work exactly like Unity's UI components do such as Button. Events are not redirected to parent elements.
     
  18. AndyLangberg

    AndyLangberg

    Joined:
    Jul 6, 2018
    Posts:
    37
    You are correct. Thank you
     
    Last edited: Jun 26, 2019
  19. Situacao

    Situacao

    Joined:
    Dec 4, 2013
    Posts:
    21
    Hey guavaman!

    Just out of curiosity/need to polish my game, have you ever tested the input latency for Rewired and Unity in general? As my game demands fast reflexes I'm thinking of trying to improve it, but I'm curious to hear if you've done some testing on it!

    I found this article on the subject too, is there any trouble of trying to implement it with Rewired?

    Thanks!
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    The very first line of the article states "I had input that was independent of framerate." This is not possible with Unity's input system or Rewired. See the FAQ:
    http://guavaman.com/projects/rewired/docs/FAQ.html#framerate-independent-input
     
  21. Situacao

    Situacao

    Joined:
    Dec 4, 2013
    Posts:
    21
  22. bdavis1000

    bdavis1000

    Joined:
    Oct 4, 2013
    Posts:
    18
    Quick question- is `Controller.hardwareName` identical regardless of platform and language/locale for the same type of controller? ie is it dangerous for me to index my button glyph icons based on this name?
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    No it is not. Never use strings for keys.

    CSV files containing GUIDs for controllers and integer ids for elements:
    http://guavaman.com/projects/rewired/docs/HowTos.html#identifying-recognized-controllers
    http://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action
     
    bdavis1000 likes this.
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Rewired 1.1.26.1 is live on the Unity Asset Store.

    Please see Updating Rewired before updating.

    1.1.26.1:

    Changes:
    - Reverted change made in 1.1.25 due to breakage of editor stepping input support: Unity Editor, Windows Standalone, Native Keyboard Handling and/or Native Mouse Handling: Pausing runtime Play mode in the Unity Editor now clears keyboard and mouse input queue and blocks further input from being queued while paused.
    - Changed Control Mapper UISelectionUtility.cs for breaking API change in Unity 2019.1.5f1.
    - OSX, Native: Device with location id of 0 are no longer filtered out to allow support for virtual HID devices. This change may affect some multi-controller adapters such as Gamecube adapters negatively because these devices expose additional invalid HID devices with location ids of 0 which will no longer be filtered out.
     
  25. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    hi all, I have a issue with rebinding touch :/

    I use a AZERTY French keyboard and when I want to rebind a control with the "4" touch it does not work ... Rewired bind "Quote" Instead. It works with 1 2 3 5 6 7 8 9 but not 4 ... Any helps ?
     
    littledwarf likes this.
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Rewired has no explicit support for keyboards other than QWERTY. Disable Native Keyboard Handling to use UnityEngine.Input.GetKey for the source of keyboard input on Windows.
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    More information:

    1. Unity's mapping for keys on Windows is based directly on the VKey returned by Windows. This has limitations because different keyboard layouts may send different "OEM" key codes for certain keys. (Example: UK keyboard returns an OEM key code for "backquote" that corresponds to the US "quote" key. If you press "backquote" on a UK keyboard in Unity, you will get the KeyCode.Quote returned. Try it.)

    2. Rewired's native keyboard keyboard input support (Windows only) was intended to be modeled after Unity's exactly. The only reason it was ever implemented was due to certain bugs in Unity's keyboard input in very old versions of Unity which have since been fixed.

    3. However, due to complaints about the aforementioned inconsistencies in UK and German keyboards with certain keys returning the wrong values (as Unity does), workarounds (hacks) were put into place to try to "fix" these specific key issues on these layouts, breaking the convention that keys would be mapped via their US-layout VKey code as Unity does. Your "4" key returning the wrong value is a direct result of these workarounds which frankly never should have been done. This means the workarounds are potentially causing unknown problems on other layouts.

    What this is going to force me to do is to either remove these hacks and revert back to the previous system to be 100% consistent with Unity regardless of incorrectly-reported keys on certain layouts, or I'm going to have to implement a slew of individual layout-based mappings internally to map these incorrect keys back to the expected key. This was never something Rewired advertised or was intended to offer and it would make it inconsistent with all other platforms which simply rely on Unity's keyboard support for input.
     
    akuparagames and littledwarf like this.
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    I am going to have to implement limited localized keyboard layout mapping instead of the global character-based system I used before to map the UK and German keys to correct the incorrectly mapped keys when using US-based VKey mapping (as Unity does). Until then, the 4 key is going to be broken on the French keyboard layout. Disable Native Input Handling in Settings -> Windows and it will fix the French keyboard, but British and German will both have the usual UnityEngine.Input mapping issues.
     
    Last edited: Jul 2, 2019
  29. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    Thx for the tips :) it works for now. Handling keyboards is always a pain in the ass ... we did it for a previous game in C# on a custom engine and it was awfull to code ...
    good luck and thx for your asset, good job :)
     
  30. VTIL_Papageorgiou

    VTIL_Papageorgiou

    Joined:
    Dec 14, 2017
    Posts:
    11
    I am trying to add a custom controller to the Oculus Quest. However I get the following exception when running the app:

    Code (csharp):
    1. 07-02 13:43:23.727 25871 25885 E Unity   : Rewired: [ERROR] Default hardware map not found!
    2. 07-02 13:43:23.727 25871 25885 E Unity   : ------- Rewired System Info -------
    3. 07-02 13:43:23.727 25871 25885 E Unity   : Unity version: 2019.1.6f1
    4. 07-02 13:43:23.727 25871 25885 E Unity   : Rewired version: 1.1.26.1.U2019
    5. 07-02 13:43:23.727 25871 25885 E Unity   : Platform: Android
    6. 07-02 13:43:23.727 25871 25885 E Unity   : Using Unity input: True
    7. 07-02 13:43:23.727 25871 25885 E Unity   : Native mouse handling: False
    8. 07-02 13:43:23.727 25871 25885 E Unity   : Enhanced device support: True
    9. 07-02 13:43:23.727 25871 25885 E Unity   : Android: Support Unknown Gamepads: True
    10. 07-02 13:43:23.727 25871 25885 E Unity   :
    11. 07-02 13:43:23.727 25871 25885 E Unity   :
    12. 07-02 13:43:23.727 25871 25885 E Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    13. 07-02 13:43:23.727 25871 25885 E Unity   :
    14. 07-02 13:43:23.797 25871 25885 E Unity   : Rewired: Rewired: An exception occurred during initialization. Input will not function.
    15. 07-02 13:43:23.797 25871 25885 E Unity   :
    16. 07-02 13:43:23.797 25871 25885 E Unity   : Exception:
    17. 07-02 13:43:23.797 25871 25885 E Unity   : System.NullReferenceException: Object reference not set to an instance of an object
    18. 07-02 13:43:23.797 25871 25885 E Unity   :   at Rewired.ReInput.iWknCdMXLaaZUDnNMBQSyAdJOpH (Rewired.InputManager_Base , System.Func`2[T,TResult] , Rewired.Data.ConfigVars , Rewired.Data.ControllerDataFiles , Rewired.Data.UserData ) [0x003be] in <bf489177f58145888eccbc495d2583d8>:0
    19. 07-02 13:43:23.797 25871 25885 E Unity   :   at Rewired.InputManager_Base.Initialize () [0x00184] in <bf489177f58145888eccbc495d2583d8>:0
    The controller has its own joystick map and works in Unity Editor or SteamVR apps.

    What could be the problem?
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    "Default hardware map not found" can only possibly ever be reported if Rewired's controller data has been corrupted or modified.

    Did you remove the Unknown controller from the ControllerDataFiles?

    Otherwise, the only possible way this can happen is Unity serialized data corruption.

    http://guavaman.com/projects/rewired/docs/KnownIssues.html#serialized-data-corruption-after-import
    http://guavaman.com/projects/rewire...ialized-data-corruption-after-upgrading-unity

    There is no other way it is possible to get this error. The Default hardware map is defined in Controller Data files and is linked in the distributed Unitypackage as a standard UnityEngine.Object reference in the inspector of Controller Data files. Your build is reporting that the object reference is null. This may also be some kind of new Unity bug on this platform for whatever reason.

    FYI,. Custom Controllers would never report this because they don't ever attempt to load the Unknown controller definition which exists only for Joysticks. Only Joysticks can ever report this error because the system is trying to load the controller definition (hardware map) for the Joystick in question. You use the term "custom controller". Are you referring to making a Rewired Custom Controller or are you really referring to creating your own Joystick definition? I suspect the latter.
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Thanks!
     
  33. Monsieur_D

    Monsieur_D

    Joined:
    Oct 31, 2013
    Posts:
    3
    Hi !

    I'm having a problem on linux builds. I don't receive mouse left clic inputs !

    I found this error message in the player.log file :

    [ERROR] Rewired: Rewired: An exception occurred during update (Update). Rewired will attempt to continue running.

    Message: The method or operation is not implemented.

    Stack Trace: at Rewired.Data.Mapping.HardwareJoystickMap.GetSpecificPlatformRoot (Rewired.InputPlatform exactInputPlatform) [0x001be] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Data.Mapping.HardwareJoystickMap.GetSpecificPlatformMap (Rewired.HardwareControllerMapIdentifier hardwareMapIdentifier) [0x00000] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Data.Mapping.HardwareJoystickMap.GetEffectiveElementIdentifierType (Rewired.HardwareControllerMapIdentifier hardwareMapIdentifier, System.Int32 elementIdentifierId, System.Boolean isDefaultMap) [0x0000d] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Data.Mapping.ControllerMap_Editor.RFCoJSsNjKuejaquRVnHKfwMgdH (System.Func`2[T,TResult] , Rewired.ControllerMap , Rewired.HardwareControllerMapIdentifier , Rewired.Data.Mapping.HardwareJoystickMap , System.Boolean ) [0x001b8] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Data.Mapping.ControllerMap_Editor.VSWpnsVBNlCcNAFAEPSPkkNAECM (System.Func`2[T,TResult] , Rewired.HardwareControllerMapIdentifier , Rewired.Data.Mapping.HardwareJoystickMap , System.Boolean ) [0x00006] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Data.UserData.pVejgcZDZObkQiywEXWksiCbItKj (Rewired.Joystick , System.Int32 , System.Int32 ) [0x00046] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Player+ControllerHelper+MapHelper.kTYmZpgOkiQMqSZVMTmCtITlfuT (Rewired.Joystick , WldFeQIZEKSgPRWcXVgqPvEtOmD[T] , NDynZVKUCRcijlFIkEZqeVjUeuUd , System.Boolean ) [0x0007c] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Player+ControllerHelper+MapHelper.WFBKxQDciUEhEYiORUZHlSPVLjR (Rewired.Joystick , System.Boolean ) [0x00049] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.Player+ControllerHelper.LVGHfqYpvAuhlnrOClahAbiOHBE (Rewired.Joystick , System.Boolean ) [0x000cd] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at iNGnIOGQhIPAmgIakofwejSfDlf.paCokxNLOvFtJjzqTcgLOdrNcphH (Rewired.Joystick ) [0x0009d] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at iNGnIOGQhIPAmgIakofwejSfDlf.OGiPYqSkapawpPTDOuHWsJkmoHF (Rewired.Joystick ) [0x0004f] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.ReInput.HnYTfOAkmDcKkBiYcARaPaUUgNsA (Rewired.BridgedController ) [0x00037] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at mmJCEoghqpWoSykCcGNEcilSKBJA.dLwoFVLuPIIrTShpcjNxBTkLfmeJ (mmJCEoghqpWoSykCcGNEcilSKBJA+XYIrTeJzuiFTAhUULrSbUMlTileb , System.Boolean ) [0x00017] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at mmJCEoghqpWoSykCcGNEcilSKBJA.ZGgAdZKjWxdOjPWVWmilpwiOHw (System.Collections.Generic.List`1[T] , System.Collections.Generic.List`1[T] , System.Boolean ) [0x000d7] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at mmJCEoghqpWoSykCcGNEcilSKBJA.GiUhuYgifIohibQeJfYtCyIwfgp (System.String[] ) [0x0018a] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at mmJCEoghqpWoSykCcGNEcilSKBJA.IDltjHVWXzHpdDJoyfkoapXJnUeA () [0x00010] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at mmJCEoghqpWoSykCcGNEcilSKBJA.Update (Rewired.UpdateLoopType updateLoop) [0x00033] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.ReInput.OwMSbnoEosdRwfziaxeqVPDLCPWd (Rewired.UpdateLoopType ) [0x0009b] in <2d7d74b559ca4240af9b51402413d0f7>:0
    at Rewired.InputManager_Base.DoUpdate (Rewired.UpdateLoopType updateLoopType) [0x0005e] in <2d7d74b559ca4240af9b51402413d0f7>:0
    ------- Rewired System Info -------
    Unity version: 2018.3.9f1
    Rewired version: 1.0.0.87.U5
    Platform: Linux
    Using Unity input: True
    Primary input source: Native
    Native mouse handling: True
    Enhanced device support: True

    Any idea where is the problem ?
     
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    You are using a seriously ancient version of Rewired -- 3 years and 2 months old. (Rewired version: 1.0.0.87.U5 as shown by the debug output.) Update it.
     
    Last edited: Jul 2, 2019
  35. cooperacion-109830

    cooperacion-109830

    Joined:
    Jul 1, 2019
    Posts:
    2
    Hi!

    I have this error in player example scenes:

    Rewired: Rewired: An exception occurred during initialization. Input will not function.

    Exception:
    System.ArgumentException: GetComponent requires that the requested component 'GUILayer' derives from MonoBehaviour or Component or is an interface.
    at (wrapper managed-to-native) UnityEngine.Component.GetComponentFastPath(UnityEngine.Component,System.Type,intptr)
    at UnityEngine.Component.GetComponent[T] () [0x00020] in C:\buildslave\unity\build\Runtime\Export\Scripting\Component.bindings.cs:42
    at Rewired.InputManager_Base.CheckTrial () [0x00015] in <09347cedd0c84f29a4e0364c58778fcb>:0
    at Rewired.InputManager_Base.Initialize () [0x000fe] in <09347cedd0c84f29a4e0364c58778fcb>:0
    ------- Rewired System Info -------
    Unity version: 2019.3.0a7
    Rewired version: 1.1.26.1.U2019
    Platform: Windows
    Editor Platform: Windows
    Using Unity input: False
    Primary input source: RawInput
    Use XInput: True
    Native mouse handling: True
    Enhanced device support: True

    UnityEngine.Logger:LogError(String, Object)
    Rewired.Logger:LogErrorNow(Object, Boolean)
    Rewired.Logger:LogError(Object, Boolean)
    Rewired.Logger:LogError(Object)
    Rewired.InputManager_Base:HandleException(ExceptionPoint, String, Exception)
    Rewired.InputManager_Base:Initialize()
    Rewired.InputManager_Base:Awake()
     
  36. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Per your message it looks like you are using a alpha version of Unity : Unity version: 2019.3.0a7

    Per the Rewired documentation alpha and beta versions of Unity are not supported. See this section of the Rewired documentation for more details.

    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#unity-alpha-beta-preview-experimental
     
    guavaman likes this.
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    @longroadhwy is correct. Rewired does not support 2019.3 which is an alpha release of Unity or 2019.2 which is a beta release. Both versions have API changes which are not accounted for in the current version of Rewired. The UnityEngine.GUILayer class has been removed in 2019.3 as the call stack shows. Rewired expects this class to be there but Unity has removed it, hence the exception. There isn't anything you can do to make this work with the trial version of Rewired.
     
    Last edited: Jul 4, 2019
  38. cooperacion-109830

    cooperacion-109830

    Joined:
    Jul 1, 2019
    Posts:
    2
    I have seen the support that is given to the devices with "Enhanced Device Support", but I have not found more explanations. Can I change the forces and activate the vibration in the Loggitech G29? If not, the steering wheel is so hard to move that I can't use it.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
  40. Undertaker-Infinity

    Undertaker-Infinity

    Joined:
    May 2, 2014
    Posts:
    112
    Hi. Rewired is great!

    I have a working setup for controlling UI via keyboard and gamepad (for PC).
    I've set up touch controls (for mobile), but when a button (or stick, or an empty region) is touched, EventSystem loses selection first, so I can't navigate the UI.

    So far I've only found I could modify Standalone Input Module, luckily the source for Rewired's version is available so commented out any calls to DeselectIfSelectionChanged, and now I can control Unity UI with touch controls (which are also Unity UI, just not selectable).

    It would be awesome to have a toggle in Rewired Standalone Input Module (and Unity's too I guess) for this behaviour.

    Thanks!
     
  41. PokeyKapstone

    PokeyKapstone

    Joined:
    Sep 18, 2018
    Posts:
    2
    Hey, I just purchased Rewired, and it's awesome! I really appreciate the time you spend engaging and helping people out.

    I was wondering if there is a way to find out what the most recent button input was, via script, and specifically whether I can check if that input was a gamepad button or a keyboard/mouse button. I've tried googling around for something like this and haven't found anything super helpful within Unity itself, so I was wondering if Rewired has something for this given its controller-centric focus.

    For context, I'm making a top-down game with a control scheme similar to Enter the Gungeon. Because of the way the game works I have two fundamentally different ways the camera works, depending on if you're using a mouse+keyboard, or a joystick. Because of this, I need to have only one system active at a time based on the current method of input. So I'd like to take the most recent button pressed, compare its controller origin, and switch to the proper camera system based on that information.

    Not sure if this is the best place for this question, but I thought I'd throw it out there. Great plugin, by the way!
     
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    This question is answered in the documentation:
    http://guavaman.com/projects/rewired/docs/HowTos.html#last-used-controller

    Additionally, potentially useful:
    http://guavaman.com/projects/rewired/docs/HowTos.html#get-contributing-input-sources
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    This is a very general Unity UI issue and very common. The easiest way to handle it without changing source code is to simply watch the value of EventSystem.currentSelectedGameObject and when it goes to null, set to to a default value based on whatever element should be selected in your current UI. You can also keep a history of the selected objects so you can select the last selected, provided it's still visible.
     
    Undertaker-Infinity likes this.
  44. PokeyKapstone

    PokeyKapstone

    Joined:
    Sep 18, 2018
    Posts:
    2
  45. VTIL_Papageorgiou

    VTIL_Papageorgiou

    Joined:
    Dec 14, 2017
    Posts:
    11
    Thank you very much for your answer.

    The asset serialization is "Force Text".
    The device has two modes (joystick & keyboard). So you are correct, it's a joystick not a controller. I was using the term controller because the Quest calls it controller.

    The device comes with its own Controller Data file, which indeed has the Unknown Controller missing. However, if compiled for Windows it does work. How is it possible that the joystick is recognized and the correct joystick map is loaded under Windows but for Android it tries to load the Unknown Controller map?

    controllerdata.PNG

    The custom Controller Data file has defaultHardwareJoystickMap entry:
    Code (csharp):
    1.  
    2. %YAML 1.1
    3. %TAG !u! tag:unity3d.com,2011:
    4. --- !u!114 &11400000
    5. MonoBehaviour:
    6.   m_ObjectHideFlags: 0
    7.   m_CorrespondingSourceObject: {fileID: 0}
    8.   m_PrefabInstance: {fileID: 0}
    9.   m_PrefabAsset: {fileID: 0}
    10.   m_GameObject: {fileID: 0}
    11.   m_Enabled: 1
    12.   m_EditorHideFlags: 0
    13.   m_Script: {fileID: -2084043497, guid: 09c9b883b79ef864a99683bb36c5776d, type: 3}
    14.   m_Name: Controller Data
    15.   m_EditorClassIdentifier:
    16.   defaultHardwareJoystickMap: {fileID: 11400000, guid: 0a19df0b717c34a49ab178e7a4c2ede2,
    17.     type: 2}
    18.   hardwareJoystickMaps:
    19.   - {fileID: 11400000, guid: 0a19df0b717c34a49ab178e7a4c2ede2, type: 2}
    20.   - {fileID: 11400000, guid: 5d47793e65ad5314e8955046fa11f359, type: 2}
    21.   joystickTemplates:
    22.   - {fileID: 11400000, guid: 91b946f6f6823f4469dbe63db04db904, type: 2}
    23.  
     
    Last edited: Jul 9, 2019
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    I don't understand what you mean by "the device comes with its own Controller Data file." Where did you get this?

    That is guaranteed to happen if the device is not recognized and the Unknown Controller is not listed in the Controller Data Files - Default Hardware Joystick Map entry.

    The device's string matching information in its Controller Definition on Android has to be wrong. Your device must be appearing as something not expected by the definition.

    Use Rewired/DevTools/JoystickElementIdentifier to view the low-level joystick information.

    So why above do you state "The device comes with its own Controller Data file, which indeed has the Unknown Controller missing." but now you say it has one?

    Don't view the YAML file. Click on the HardwareJoystickMap in the Unity Editor and see if these object links are valid and what they point to.

    I can see by looking at the GUIDs that this is wrong. You have the same GUID listed in the Default Hardware Joystick Map and as a normal Hardware Joystick Map.

    0a19df0b717c34a49ab178e7a4c2ede2

    Therefore I am assuming you have linked the Quest controller's definition here assuming all failed matches will fall back to the Quest controller. This will not work.

    The Default Hardware Joystick Map is a special map with hundreds of axes and buttons designed to allow any controller of any type to work. You cannot use a map that only matches one joystick and have it work. It will always fail. There is only one single valid Default Hardware Joystick Map -- the one Rewired comes with. Nothing else will work in this field.

    Restore the link to the original Unknown controller and it will work, but your joystick still will not be recognized because the controller definition for it is obviously not matching whatever data your Quest is returning for the controller.
     
    Last edited: Jul 9, 2019
  47. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    502
    Hi there,

    I have an issue with D-Pad input using Xbox One controllers. The d-pad input works fine for navigating menus in my UI category map, and moves 4 directions perfectly fine.

    For my game play category map I have the Left Stick X set to use Cursor Horiz with full axis range, Left Stick Y set to use Cursor Vert with full axis range then D-Pad Up, Down is set to same Cursor Vert (but differ on Positive or Negative for axis contribution, same with Left and Right both using Cursor Horiz (differing on positive and negative).

    So this setup works for all other controllers and platforms. But on xbox and only when trying move the cursor using only up or down d-pad buttons the cursor doesn't move, but the d-pad left and right do work. Only if I engage the horizontal buttons so that I have diagonal direction input on the d-pad do the vertical d-pad inputs start to work. But if let go, then just press up or down only, I don't get any movement.

    I was originally only using the [ T ] Gamepad Template, but tried mapping all of the inputs to a direct Xbox One Controller template to define this one directly, but it doesn't help, and doesn't change the behaviour at all.

    I'm just stuck on what to try because the code all works for every other controller I've tested from other consoles, steam controller, keyboard etc. and I've only got one block of code that's reading the input ie. it doesn't change per platform so it should work the same. I've made sure to update to the latest Rewired, I read your docs for issues and tried reinstalling in case some Input manager events are missing.

    EDIT: and by the way I do have the Gamepad.dll installed.

    Thanks,

    Jason
     
    Last edited: Jul 10, 2019
  48. VTIL_Papageorgiou

    VTIL_Papageorgiou

    Joined:
    Dec 14, 2017
    Posts:
    11
    The device has a Unity asset that comes with a Rewired Controller Data file bundled.
    https://github.com/VRGO-CHAIR/VRGOUnitySDK

    Thank you very much, I have realized that I can use Rewired default Controller Data file and just add the custom joystick map. It's working now!
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    The answer to questions like this is always to use Debug Information. There's no other way to track down such a complex issue:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information

    Follow the checklist at the bottom.

    Wild guess:
    Clear saved XML / PlayerPrefs - http://guavaman.com/projects/rewired/docs/UserDataStore.html#saved-xml-not-synced
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    That sounds impossible. You're going to have to view the real value of the D-Pad buttons on the Controller. If the D-Pads are returning True for their individual buttons, then it's at a higher level. This is part of the checklist I mentioned above.

    Then log or view the value returned by the Actions in the Player. If these look correct, it's something in your code. If it's not, then it's mappings.

    The only possible way I can see this happening is if the D-Pad values are inverted and you have multiple mappings on each element that are conflicting with each other.