Search Unity

Rewired - Advanced Input for Unity

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

  1. damonwall

    damonwall

    Joined:
    Jan 22, 2013
    Posts:
    14
    @guavaman Sorry to bug again, but is there a chance you may have an idea how to solve my problem? (which is gamepads aren't detected on Android) Mb there're other plugins or smth I can use, or any particular version of Unity that's known to handle this problem
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No, I don't have any idea. This problem is below the Rewired inside Unity or Android. If Unity cannot see the device, Rewired cannot see the device and no input is possible. I don't know of any solution. I don't know of any native Android input plugins for Unity that would circumvent their input system and go directly to the OS. Maybe Unity's new input system would be different, but that's just a guess. You could also try to update to a more recent version of Unity -- at least within the same 2018 branch. I do not keep a list of what works and what doesn't work in each release of Unity so I can't give you any specific information about that.

    I wouldn't expect the Moga device to work. Moga devices, at least in the past when I worked with them, required a special Moga SDK to be used. Unity should be able to see any device that works through the standard Android HID gamepad API.
     
    Last edited: Aug 25, 2021
  3. hurleybird

    hurleybird

    Joined:
    Mar 4, 2013
    Posts:
    258
    This is going to look like an odd question (please, no lectures of "why would you need this?" I'm working with convoluted requirements not of my own choosing), but is there a way to get the order of Joysticks in Rewired to mirror the order of Joysticks in the legacy input system (Eg. the order seen in Input.GetJoystickNames())?
     
  4. Kazeon

    Kazeon

    Joined:
    May 22, 2017
    Posts:
    41
    Hi @guavaman, I want to ask something. Does rewired support multiple control presets? What I'm talking about is having multiple key mapping for the player to chose from, while allowing player to customize the key binding for each map, if that makes sense. If it's possible, then how can we achieve that? Thanks in advance!

    EDIT:

    Actually, nevermind for now. I will experiment with this "layout" feature first. Will be back later.
     
    Last edited: Aug 26, 2021
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No. There is no relationship between the two and no relationship can be made.
     
    hurleybird likes this.
  6. damonwall

    damonwall

    Joined:
    Jan 22, 2013
    Posts:
    14
    Hi @guavaman
    I've got a question about ReWired and Il2CPP issue.
    I've tested builds with Mono for some time - everything seems to be working great!
    But when I try to build with Il2CPP - everything works until I try to control via touch interface. Then input just hangs.
    There're no errors or problems in log. The only thing that I repeatedly see on log is this (right after it hangs):
    Code (csharp):
    1.  
    2. 08-26 17:55:54.708 24429-24434/com.TestApp I/art: Thread[2,tid=24434,WaitingInMainSignalCatcherLoop,Thread*=0x55ac936fa0,peer=0x12d4f0a0,"Signal Catcher"]: reacting to signal 3
    3. 08-26 17:55:54.818 24429-24434/com.TestApp I/art: Wrote stack traces to '/data/anr/traces.txt'
    4.  
    Callstack is always the same even if I'm not touching anything and not doing anything,
    amd if I try to do some touching - application repeatedly suggests that it's hanged and needs to be closed.
    Code (CSharp):
    1. nativeInjectEvent:-1, UnityPlayer (com.unity3d.player)
    2. injectEvent:-1, UnityPlayer (com.unity3d.player)
    3. onTouchEvent:-1, UnityPlayer (com.unity3d.player)
    4. dispatchTouchEvent:9317, View (android.view)
    5. dispatchTransformedTouchEvent:2550, ViewGroup (android.view)
    6. dispatchTouchEvent:2241, ViewGroup (android.view)
    7. dispatchTransformedTouchEvent:2556, ViewGroup (android.view)
    8. dispatchTouchEvent:2255, ViewGroup (android.view)
    9. dispatchTransformedTouchEvent:2556, ViewGroup (android.view)
    10. dispatchTouchEvent:2255, ViewGroup (android.view)
    11. dispatchTransformedTouchEvent:2556, ViewGroup (android.view)
    12. dispatchTouchEvent:2255, ViewGroup (android.view)
    13. superDispatchTouchEvent:2403, PhoneWindow$DecorView (com.android.internal.policy)
    14. superDispatchTouchEvent:1737, PhoneWindow (com.android.internal.policy)
    15. dispatchTouchEvent:2870, Activity (android.app)
    16. dispatchTouchEvent:2364, PhoneWindow$DecorView (com.android.internal.policy)
    17. dispatchPointerEvent:9539, View (android.view)
    18. processPointerEvent:4289, ViewRootImpl$ViewPostImeInputStage (android.view)
    19. onProcess:4152, ViewRootImpl$ViewPostImeInputStage (android.view)
    20. deliver:3691, ViewRootImpl$InputStage (android.view)
    21. onDeliverToNext:3744, ViewRootImpl$InputStage (android.view)
    22. forward:3710, ViewRootImpl$InputStage (android.view)
    23. forward:3836, ViewRootImpl$AsyncInputStage (android.view)
    24. apply:3718, ViewRootImpl$InputStage (android.view)
    25. apply:3893, ViewRootImpl$AsyncInputStage (android.view)
    26. deliver:3691, ViewRootImpl$InputStage (android.view)
    27. onDeliverToNext:3744, ViewRootImpl$InputStage (android.view)
    28. forward:3710, ViewRootImpl$InputStage (android.view)
    29. apply:3718, ViewRootImpl$InputStage (android.view)
    30. deliver:3691, ViewRootImpl$InputStage (android.view)
    31. deliverInputEvent:6011, ViewRootImpl (android.view)
    32. doProcessInputEvents:5985, ViewRootImpl (android.view)
    33. enqueueInputEvent:5946, ViewRootImpl (android.view)
    34. onInputEvent:6117, ViewRootImpl$WindowInputEventReceiver (android.view)
    35. dispatchInputEvent:187, InputEventReceiver (android.view)
    36. nativeConsumeBatchedInputEvents:-1, InputEventReceiver (android.view)
    37. consumeBatchedInputEvents:176, InputEventReceiver (android.view)
    38. doConsumeBatchedInput:6085, ViewRootImpl (android.view)
    39. run:6140, ViewRootImpl$ConsumeBatchedInputRunnable (android.view)
    40. run:860, Choreographer$CallbackRecord (android.view)
    41. doCallbacks:672, Choreographer (android.view)
    42. doFrame:602, Choreographer (android.view)
    43. run:846, Choreographer$FrameDisplayEventReceiver (android.view)
    44. handleCallback:742, Handler (android.os)
    45. dispatchMessage:95, Handler (android.os)
    46. loop:157, Looper (android.os)
    47. main:5601, ActivityThread (android.app)
    48. invoke:-1, Method (java.lang.reflect)
    49. run:774, ZygoteInit$MethodAndArgsCaller (com.android.internal.os)
    50. main:652, ZygoteInit (com.android.internal.os)
     
  7. damonwall

    damonwall

    Joined:
    Jan 22, 2013
    Posts:
    14
    Update on my prev question - I've upgraded to a newer version of Unity, and problem somehow went away. So I guess that was a bug in 2018.2.5f, at least in 2018.4.36f1 it's not present.
    Sorry for disturbing! =)
     
  8. hurleybird

    hurleybird

    Joined:
    Mar 4, 2013
    Posts:
    258
    No worries. Assuming that nothing changes in terms of Rewired config, number of and which USB ports controllers are plugged in at, and OS settings, is it reasonably (eg. doesn't need to be 100% bullet proof) safe to assume that the Joystick order reported by Rewired will remain consistent from one playthrough to the next? Absent that, are there any ways to distinguish one identical controller from another?

    My intuition is telling me that the answers are yes and no respectively.
     
  9. animal531

    animal531

    Joined:
    Aug 26, 2014
    Posts:
    25
    How do I deploy my default keys that I set up during development to a build?

    When I make a build all the keys are empty and need to be re-filled in by the player (since I take it that he doesn't have my Prefs that's been saved to my development machine)?
     
  10. dmarqs

    dmarqs

    Joined:
    Oct 16, 2013
    Posts:
    41
    Hi,

    So I'm having issues trying to make the right stick from Xbox One Controller works. I tried with 2 Xbox One controllers, tried in a Windows 10 Intel based, Windows 10 running on a Mac with Parallels, moved Rewired to a Plugins folder, moved back, nothing seems to work.

    The right stick is only working the X value but it changes the Y camera. In Unity Editor (2020.3.8f1) is working perfectly. Don't know what I do anymore, played with different settings under Joystick Maps in Gamepad Template and Xbox One Controller but again, nothing seems to work.

    So I'm not too experienced with inputs, so I don't know if I should have used any other settings like Joystick Layout or Map Categories. I followed the basic tutorial so it almost defaults values for me.

    Any help, please? =/
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I don't recommend you build anything on top of assumptions. Everything you are asking is very dependent on the build platform, the input source(s) in use, the devices in use and how those devices are connected. No guarantee is made whatsoever about the order in which devices will be listed in the list of joysticks.

    Example:
    XInput can and does change the controller id order at random when a device is connected and between reboots.

    This is the only possible way if you mean in different game sessions:
    https://guavaman.com/projects/rewir...l/P_Rewired_Controller_deviceInstanceGuid.htm

    And this is again, subject to the limitations and specific functioning of the build target and input source(s) in use. For example, this does not work on OSX as well as other platforms where unique device identifiers are not available.
     
    Last edited: Aug 29, 2021
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#works-in-editor-not-in-build

    Whatever configuration you specify in the Rewired Input Manager will be reflected in a build. The above link outlines many scenarios that can cause this to fail.
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Moving Rewired to a different folder will have absolutely no impact on how input functions. This is a false flag.

    1. Clear Player Prefs:
    https://guavaman.com/projects/rewired/docs/UserDataStore.html#saved-xml-not-synced

    2. Find out exactly what is not working and why using the tools provided for this exact purpose:

    "Debug Information is the single most powerful tool to figure out why "it doesn't work." Use it. It allows you to visualize every single Rewired object in the system at runtime including Controller Maps and bindings. Before contacting support asking why something doesn't work, debug your issue using Debug Information."

    Follow the checklist in that link.
     
  14. guavaman

    guavaman

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

    Unity 4, 5, and 2017 support has been dropped, and Unity 2018 now Requires 2018.4.0f1+. This was not by choice. The Unity Asset Store no longer accepts asset updates for any version of Unity prior to 2018.4.0f1, which I found out while I was trying to upload the update.

    1.1.40.0:

    Changes:
    - Disabling Visual Studio 2019 jump optimizer for Windows IL2CPP builds is no longer required.
    - Performance improvements.
    - UFE2 Integration: Reworked integration script again due to breaking changes in Unity causing EventSystem exceptions to be thrown.
    - UFE2 Integration: Changed supported version to 2.4.1.

    API Changes:
    - Changed return type of Player.ControllerHelper.GetLastActiveController<T> to T instead of Controller.

    Bug Fixes:
    - AxisCalibration.SetData no longer overwrites default calibration data.
     
    Last edited: Aug 29, 2021
    hurleybird likes this.
  15. dmarqs

    dmarqs

    Joined:
    Oct 16, 2013
    Posts:
    41
    Thanks! After long debug hours the issue was that I was using Cinemachine I it was missing the bridge. =/ But after implementing the bridge it started working. Thanks! =D
     
  16. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    Sorry if this is a silly question but can this asset do button combinations, kind of similar to how it can with the keyboard, or is that solely for binding keys?
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Sapien_ likes this.
  18. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    109
    I'm also interested in this, could use some help. The documentation only covers if both buttons
    are pressed together exactly on the same frame. If there's any delay between the two the action will be dropped.

    I currently use GetButton and start a coroutine with a timer for the individual buttons.



    Code (CSharp):
    1. private void CheckInput(){
    2.   LeftAction = _input.GetButtonDown("LeftAction");
    3.   RightAction = _input.GetButtonDown("RightAction");
    4. }
    5.  
    6. private void ProcessInput(){
    7.  
    8.     if(LeftAction) StartCoroutine(BothTimer(true));
    9.     else if(RightAction) StartCoroutine(BothTimer(false));
    10.  
    11. }
    12.  
    13. private IEnumerator BothTimer(bool left){
    14.  
    15.     bool bothPressed = false;
    16.  
    17.     BothActionTimer = 0;
    18.  
    19.     while(BothActionTimer < BothActionTimeout){
    20.         BothActionTimer += Time.deltaTime;
    21.  
    22.         if(_input.GetButton("LeftAction") && _input.GetButton("RightAction")){
    23.             bothPressed = true;
    24.             _animator.SetTrigger("BothKick");
    25.             yield break;
    26.         }
    27.  
    28.  
    29.         yield return null;
    30.     }
    31.  
    32.     if(!bothPressed){
    33.         if(left)
    34.             _animator.SetTrigger("LeftKick");
    35.         else
    36.             _animator.SetTrigger("RightKick");
    37.     }
    38.  
    39.     yield return null;
    40. }
    41.  
     
    Last edited: Sep 1, 2021
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    That's not correct. Here is the example in that documentation link:

    Code (csharp):
    1. // This example shows a simple handling of a 2-button combo where the
    2. // modifier button must be held down and the primary button pressed
    3.  
    4. bool modifier = player.GetButton("ModifierAction"); // get the "held" state of the button
    5. bool primary = player.GetButtonDown("PrimaryAction"); // get the "just pressed" state of the button
    6.  
    7. if(modifier && primary) { // modifier was held or just pressed and primary was just pressed
    8.    // Do something
    9. }
    This is not two buttons pressed on the same frame. This is one button is held (modifier) and one button is just pressed (primary). Notice one uses GetButton while the other uses GetButtonDown. This handles both cases of the two buttons pressed exactly at the same time and the case of the modifier was held down first, then the primary was pressed second. It will not trigger if the primary is held down first, then the modifier is pressed second.

    This documentation is not attempting to describe how to handle the needs of, for example, a fighting game where pressing 3 buttons near-simultaneously with some kind of time-based tolerance will trigger a spin punch. Interpreting input over time (gestures) is a separate topic that should be handled by code that consumes input from the input system and interprets it in order to trigger something to happen, but is not part of that input system.
     
    Last edited: Sep 1, 2021
  20. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    109
    Ah thanks, I missed that they both weren't buttonDown, causing the single frame chance issue. As you mentioned this only works in one direction. I'll try doing this but with a modifier both ways and see if it works!
     
  21. dillo554

    dillo554

    Joined:
    Sep 3, 2021
    Posts:
    1
    Not everytime, but frequently when switching scenes Rewired stops registering that a user is holding a button. If you let go and repress the button it registers again.


    Not sure if this is a bug, intended, or something I’m doing wrong?
     
  22. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    Hi, I want to get the current hovered gameObject and I found this solution, which works well with unity's native InputModule.
    But the class RewiredStandaloneInputModule does not have a method called 'GetLastPointerEventData'.
    Is there any other way to get the current gameobject under pointer?
     
  23. Mar-Zin

    Mar-Zin

    Joined:
    Apr 3, 2019
    Posts:
    1
    Hi, I have a problem with identifying xbox controller with rewired. I want to stop game on controller disconnection until player reconnect with exactly the same physical controller and resume it only if controller is right. All other controller should be completely ignored. I tried to check controller id, but each time I reconnect controller it gets different id then it had before.
    How can rewired detect persistent id of xbox controller signed to physical device?
     
  24. finter

    finter

    Joined:
    May 11, 2019
    Posts:
    1
    Hello,

    I'm trying to do as much of my Rewired-related stuff in scripting as I can. Currently trying to configure a PlayerMouse and RewiredStandaloneInputModule to use a controller-controlled pointer to interact with Unity UI. Using the prefabs and component versions included with Rewired I'm able to do this easily.

    A lot of the documentation also mentions being able to do this via scripting, but I can't find any way to access the RewiredStandaloneInputModule through scripting. Am I missing something dumb? Is my import just messed up?

    e.g.
    If I try
    Code (CSharp):
    1. Rewired.Integration.UnityUI
    or similar, the compiler says the Integration namespace doesn't exist.

    Using Unity 2019.4.28f1 with Rewired 1.1.34.1.U2019
     
  25. ImproxGames

    ImproxGames

    Joined:
    Apr 3, 2017
    Posts:
    20
    Hi,

    I'm experiencing an issue where input in the background is not ignored if the game launches in the background.

    Rewired version 1.1.29.4
    Unity version 2019.4.25f1

    Run in background is TRUE
    Ignore Input When App Not In Focus is TRUE

    Current behavior:
    Launch a built version of the game.
    Focus another window, for example Chrome. This causes the game not to be focused when it launches.
    Moving the mouse and using the keyboard in the main menu screen causes buttons to be selected. This is detectable by sound effects triggered OnSelect.

    Expected behavior:
    Launch a built version of the game.
    Focus another window, for example Chrome
    Moving the mouse and using the keyboard does nothing.


    The behavior returns to correct if the game is focused once and then unfocused.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Button state is not reset when loading a scene. Rewired knows nothing at all about scene loading. If you are destroying the Rewired Input Manager and recreating it again in the new scene, a ton of stuff will be reset. State from one instance does not carry over to the next instance.

    Read this for advice on how to use the Rewired Input Manager in your project:
    https://guavaman.com/projects/rewired/docs/InputManager.html
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired has the same functions the base Unity versions of the components have. GetLastPointerEventData exists in the PointerInputModule, not the StandaloneInputModule, therefore the same function exists in the RewiredPointerInputModule, not the RewiredStandaloneInputModule. Both functions, the Unity and Rewired versions, are protected and cannot be accessed by a class outside of itself of a class that inherits from that base class.

    The post you reference shows hack where they created a new class that inherits from StandaloneInputModule in order to expose a new function that uses the data from GetLastPointerEventData. You could do the exact same thing with the RewiredStandaloneInputModule if you chose to do so.

    There is no new built-in feature in the RewiredStandaloneInputModule to get this information. The RewiredStandaloneInputModule does not attempt to solve issues with Unity UI's design, it does not attempt to add a bunch of new features that Unity's own component didn't have. It is a simple bridge between Unity UI and Rewired.
     
    ookk47oo likes this.
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    A controller should not get a new id every time you connected it. But XInput is special. XInput has 4 indices which it uses to denote the player using that controller. XInput does not consistently return the same user id every time you plug a controller back in. This is a problem with XInput and it cannot be solved by software on top of XInput like Rewired. If you keep unplugging and replugging that controller, you will likely see it alternate between two or four ids. Rewired has no way to know that that specific controller that you just plugged in is related to a previously connected controller except through this XInput id. If XInput's id shifts, so will Rewired's. Rewired uses that XInput id to match it back to a previously connected Controller id and therefore what Player previously owned that controller.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired Standalone Input Module is a MonoBehaviour-derived Component. You access all Components in Unity the same way. They provide many ways to reference or find components. Store a reference in an inspector variable, GameObject.Find, GetComponent, etc, etc.

    Unity's EventSystem exposes the current input module:
    https://docs.unity3d.com/2018.2/Doc...ntSystems.EventSystem-currentInputModule.html

    The Rewired.Integration.UnityUI namespace does exist and you can see it declared in the RewiredStandaloneInputModule.cs file at the top. The only way the namespace wouldn't exist is if you are trying to access it from a location that cannot access the assembly in which the script exists. For example, if you put Rewired in the root assets folder, none of its compiled classes will be accessible from within the Plugins folder because Plugins compiles to an assembly that does not reference the main Assembly-CSharp.dll. These problems are easily compounded if you're using ASMDEF files.
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired relies on MonoBehaviour.OnApplicationFocus to know whether of not the application is focused. If Unity gives it in the incorrect data by not sending the callback because you defocused it before MonoBehaviors were executing and Unity doesn't send this event retroactively, there's nothing Rewired can do. Unity has no method to poll for this information. I had previously implemented native focus events on Windows due to issues with Unity's focus handling, but removed it because of all kinds of problems with edge cases and fighting with Unity's concept of focus. The application is running under Unity and therefore Unity should be in charge of determining whether the application is focused or not, not the input system.
     
    Last edited: Sep 4, 2021
    ImproxGames likes this.
  31. ImproxGames

    ImproxGames

    Joined:
    Apr 3, 2017
    Posts:
    20
    Apparently, this is a known issue that Unity won't fix. Darn... https://issuetracker.unity3d.com/is...f-the-standalone-player-loses-focus-on-launch
     
  32. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    Indeed, thx.
     
  33. little_box

    little_box

    Joined:
    Aug 22, 2017
    Posts:
    28
    Hi, guavaman. Where can I download the latest 'Rewired Controller Element Identifiers' file? When I connected to the Switch Pro Controller, I found D-Pad was identified as Control Pad.
     
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
  36. TrashCanHero

    TrashCanHero

    Joined:
    Jul 8, 2018
    Posts:
    4
    Forgive me if this has already been asked but would it be possible to set up the Valve Index controllers? The documentation only mentions either oculus or openVR and using openVR didn't work so I'm wondering if I'm missing a step or if I need to set up a custom controller for it
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No. Rewired doesn't directly support any VR APIs. You must use Custom Controllers to support devices that are not exposed as standard HID joysticks or gamepads. Unity wraps some VR APIs and exposes fake joysticks for their features if using Unity as the input source. They are maintaining the VR libraries and doing all that work across platforms. But Unity fallback input is vastly inferior to Rewired's native input on most platforms for every controller except VR.
     
  38. EmmetOT

    EmmetOT

    Joined:
    Apr 25, 2016
    Posts:
    44
    Hello! I have an issue I can't find the solution for. Rewired is complaining that it's not referencing the assembly UnityEngine.

    This error shows up even in my own code, whenever I reference anything from rewired. I've already tried running the rewired installer again. (The 'show potential fixes' button in the screenshot is no help either.)

    Everything still works fine, it's just super annoying to have all these false bugs.
     
    Last edited: Sep 7, 2021
  39. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Sounds like an issue with intellisense in Visual Studio. Faced a similar issue when updating to Unity 2020.

    There are lots of suggestions here:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/
     
  40. EmmetOT

    EmmetOT

    Joined:
    Apr 25, 2016
    Posts:
    44
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I don't have any advice for you. This is all determined by how Unity chooses to build the Visual Studio project. It's outside my control to affect. Rewired's DLLs and scripts reference UnityEngine.dll. If that reference isn't being made somehow, it's not going to find the information it needs. All I can suggest is to delete or rebuild the vs solution and projects. Contact Unity support and file a bug report.
     
  42. Spabbage

    Spabbage

    Joined:
    Feb 15, 2015
    Posts:
    37
    Hi,

    I have "Auto-Assign Joysticks" enabled with the idea that when a controller is plugged in it is paired with P1, the second with P2 etc.

    I've found a brand of mouse Roccat that register as a Joystick. So if this mouse is plugged in it gets assigned to P1 and the first controller would be assigned to P2 leaving no way to play singleplayer with the controller.

    What is the preferred fix for this? Should I whitelist only a subset of controllers or is there a way to say don't use mice as joysticks or something?
     
  43. Spabbage

    Spabbage

    Joined:
    Feb 15, 2015
    Posts:
    37
    Just to provide a little more info on the above issue. There's an entry in the FAQ for the mouse copied below. If this isn't fixable, I could use this explanation to tell players how to fix it in device manager.


    After I installing the software on the Tyon, my gamepad doesn't work anymore.

    The Tyon includes a hardware which is also used in a gamepad. In some cases this may lead to bugs. In such cases it often helps to deactivate the joystick function of the Tyon in the Device Manager. You will find this in the Device Manager under Input Devices/Human Interface Devices and is called "Virtual XInput Device". You can disable it with a simple right click.
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Let's assume Windows, Raw Input, because all platforms and input sources are different.. Rewired already has code that says don't use mice as joysticks. The only HID devices Rewired considers are ones that report the HID id for Joystick, Gamepad, Multi-axis device, and Consumer Control Device. Mouse is not included. For the mouse to show up means it is creating a HID device that is reporting itself as one of those HID profiles.

    Rewired has no concept of black or whitelisting devices at the OS level. Every single platform and input source has its own criteria for identifying devices. Creating a of blacklist would be just as complicated as the whole controller definition system, with per-input-source matching criteria per device. There isn't any way to fix this.

    Based on your 2nd message, the mouse driver is the problem and the gamepad it creates should be disabled by the user. This was an intentional design feature put in place by the mouse manufacturer and doesn't need to be documented in your game (or in Rewired) in my opinion.
     
  45. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Not sure if it was in that thread, but what worked for me when I ran into this was close Unity. Open the project folder and delete all csproj + sln files in the base folder. Open it back up in Unity and go to Assets -> Open C# Project. It doesn't work 100% of the time, but for the most part it seems to flush out whatever was causing intellisense to have that false issue.
     
    EmmetOT likes this.
  46. steve_dy

    steve_dy

    Joined:
    Feb 20, 2014
    Posts:
    26
    Hi! I tried the following: https://guavaman.com/projects/rewired/docs/HowTos.html#get-element-name-for-action to retrieve the Action buttons for certain Actions on iOS after the Game Controller was remapped through iOS settings but I found it does not send the updated information.

    Does Rewired can identify when a button is remapped through the iOS Settings menu?

    If the answer to the last question is no, do you have an ETA about when is Rewired going to support the remapping done to game controllers through iOS/tvOS/macOS settings?

    Thanks in advance! I hope I explain! :)
     
  47. IronRule

    IronRule

    Joined:
    Jul 19, 2015
    Posts:
    2
    Hey, hoping you can help - been using Rewired for my game with 4 players with no issues and now looking to expand it to allow 8 players - but have been having troubles having more than 4 controllers be recognized.
    To test I created a new Unity project (2021.1.5f1) and imported Rewired. Installed it, confirmed Input Manager is updated with all the new rows, and went to the 8 player test scene.
    Starting the scene I can move with 4 of the controllers but not with the 5th. If I disconnect a controller the 5th controller immediately starts to move a player around. Reconnecting the controller and it wont move any character but I can see warnings in the Unity Editor when a controller is connected/disconnected.
    Looking into the code, Rewired.ReInput.controllers only ever shows 4 joysticks.
    Have confirmed in Windows Game Controllers window that all 5 controllers are connected and I can get button prompts from all 5.
    Basically from what I can tell Windows/Unity confirm that all 5 joysticks are connected/working but they aren't added to the list of joysticks in Rewired when it connects
     
  48. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    The Rewired documentation talks about how to get around that issue. I am guessing you are using Xinput for your controllers on Windows.

    https://guavaman.com/projects/rewired/docs/KnownIssues.html#more-than-4-xbox-controllers
     
    guavaman likes this.
  49. IronRule

    IronRule

    Joined:
    Jul 19, 2015
    Posts:
    2
    Thats probably the thing! I spent a decent amount of time going over the docs this afternoon but didnt see that issue. Thanks! I think the tradeoffs will actually be fine with my game so I think Ill be good to go
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired does not support Apple's controller element remapping. See this for more information:
    https://forum.unity.com/threads/rewired-advanced-input-for-unity.270693/page-145#post-7134209

    There is no ETA on support for this feature because it would require a complete native input solution on iOS that does not rely on Unity's input system as well as an undetermined amount of reworking of the core design of Rewired's controller system.