Search Unity

Rewired - Advanced Input for Unity

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

  1. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Input Behaviors: http://guavaman.com/projects/rewired/docs/InputBehaviors.html

    Input Behaviors affect the value of Actions. Calibration affects the value of hardware axes.

    Control Mapper also shows how to use Input Behaviors for various sensitivities such as Mouse Look. Please look at the example scenes provided in the Extras/ControlMapper/Examples folder.
     
    Little_Gorilla likes this.
  2. Little_Gorilla

    Little_Gorilla

    Joined:
    Oct 11, 2013
    Posts:
    69
    Ah I was actually looking into Input Behaviours before Calibration, but now it makes sense that Input Behaviours will do what I need.
    One thing I was confused about was a Joystick Axis Deadzone, there isn't one listed in the InputBehaviours, but there is a Button Dead Zone. Does the Button Dead Zone cover the Joystick Axis Deadzone too?
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    No. Button Dead Zone only applies to Actions bound to hardware axes when queried with GetButton. Button Dead Zone is a means to define how much the axes need to be pressed before the "button" value of the Action returns true. This only applies when an Action is being used as a button, but the underlying source is an axis. It might help to think of an Action as a "virtual element" that can be treated as both a button and an axis. If queried by GetButton, it's a "virtual button", if by GetAxis, it's a "virtual axis."

    An Input Behavior is a set of rules that affect how the incoming input values contribute to the Action's final value. The incoming values processed by these rules determine the final "virtual button" and "virtual axis" values of an Action.

    Input Behaviors cannot discriminate between data coming from individual specific axes, buttons, or other elements -- their settings are applied globally to the Action value per-Player, but certain settings only apply based on the incoming input source device type (joystick axis sensitivity, mouse axis sensitivity, etc.). The Input Behavior's rules apply to the Action's value regardless of the specific device(s) and element(s) being used to determine the Action's value. That is to say, you cannot specify: Sensitivity for Controller Type Joystick, Controller: Xbox 360 Controller, Element: Left Stick X, Action: Run. Instead, you specify Sensitivity for Action: Run, Controller Type: Joystick and it will be applied to when any joystick axis contributes value to the Run Action.

    You should not be thinking of Input Behaviors as a means of calibrating individual axes per-Action. They cannot do that. The only axis modifier they contain is Sensitivity, and that only by a simple multiplier. If you need to actually calibrate a hardware axis (dead zone, min, max, apply a curve, etc.), you need to do it on the hardware axis calibration, but it cannot be done per-Action.

    A system that could apply separate hardware axis calibration values per-Action, per-controller, per-element would be extremely complicated, especially if it had a visual editor to apply these settings.

    There is no way to set an axis dead zone for a specific axis on a specific joystick only for a specific Action. Input Behaviors, while not equivalent to hardware calibration, can be very useful for certain things like Look Sensitivity, allowing the user to tune the mouse sensitivity, joystick sensitivity, and custom controller sensitivity separately for specific Actions.
     
    Last edited: Jan 13, 2017
  4. Little_Gorilla

    Little_Gorilla

    Joined:
    Oct 11, 2013
    Posts:
    69
    T
    Thanks for the thorough reply!
    I'll stick with Input Behaviours then, it should be good enough for me, as just doing sensitivity per action is much easier than creating an intense system for axis calibration. Thanks Guava!
     
  5. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    400
    Hey @guavaman

    I've been using Rewired for a while now with my game Party Panic on Steam Early Access (and it's saved me countless hours and headaches) with allowing so many different controllers work out of the box. I've also made a custom remapping screen (heavily modified, but based off the included remapping example, example video here -https://www.youtube.com/watch?v=FQJOGtsKNBM) to allow any controllers not auto-detected to be used after a bit of manual remapping. This custom remapping screen also has a little text box (under the controller icon in the video) that will show which button on which controller is currently being pressed. This has worked great for 95% of players/controllers and made it so nearly every controller that can be detected by the game can be used, and that's great!

    However I'm getting reports still that some people are having issues with their controllers for various reasons, I was wondering if you might have any idea what could be causing these issues, and if not maybe you might have some input and advice on how best to problem solve these issues myself. I've tested personally with common controller types to confirm everything seems to be working correctly in the game on my end (PS3, PS4, Xbox360, Xbox One, generic controllers)

    Problem #1 - Player is trying to use three PS4 controllers and 1 Steam controller. Says that when using only one controller (either PS4 or Steam controller) inputs work fine, but as soon as they connect a second controller all control is lost and both controllers no longer work. Looking at the logs it shows all 4 controllers are being recognized and assigned by Rewired on startup, however Rewired states that there are 7 joysticks attached (3 Sony DualShock 4, and 4 "Xinput Gamepad 3"), which seems like it's detecting the Steam controller 4 times, but I'm not sure if that has anything to do with the issue..

    Problem #2 - Player is trying to use an Xbox One Controller (USB 2.0), says when in the controller remapping as soon as he pressed input he is shown that a button/stick is being pressed immediately (so it's 100% responsive there), however when playing the game there is "2 seconds of latency between the time I push the thumb stick and something happens on screen".
    Resolved Problem #2: This was resolved. Player's framerate was super low, changing the Graphics Quality increased the framerate and reduced input lag. I didn't think input was tied to framerate that closely, but I guess I was wrong! :p

    Problem #3 - Player is trying to use one Xbox 360 Controller and one Speedlink Torid (never heard of this model before). The Speedlink Torid was not being mapped automatically, but he could go in and map this controller so it would work manually. He was also adjusting the Xbox 360 mappings (inverting y). Custom mappings save and reload without issues usually, but when he would close and reopen the game all the mappings for the Speedlink Torid controller were cleared, but the modified mappings for the Xbox 360 controller had saved and loaded successfully. Saving and loading works fine 100% of the time in all my tests.

    I thought you might have some idea about these issues, and even if you don't you might have some advice on how I can best go about approaching these issues myself.

    Thanks, and keep up the awesome work!
     
    Last edited: Jan 15, 2017
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Your game looks great! Awesome to hear how Rewired has been helpful to you.

    Offhand, it sounds like there are driver problems on this user's machine. Have him try opening Device Manager and see if there are multiple instances of the Xbox controller appearing. If there are, remove each in Device Manager and then let Windows reinstall the driver once after unplugging and plugging the device. If he has any DualShock 360 emulation software installed like DS4Win, have him remove it.

    If multiple joysticks appear for each device to the system, Rewired will assign each of these joysticks to a Player (assuming you've left Joystick Auto-Assignment enabled) which will guarantee one or more Players will be assigned phantom non-working joysticks.

    Input latency is definitely tied to frame rate, but a 2-second lag would only occur with a framerate so low that it would be completely unplayable already due to the slide-show video update. If the user wasn't just exaggerating, something else would have to be involved here like driver/system/hardware issues.

    The only way to prevent this is to have a separate input thread receiving the input at a high frequency and the main game thread grab the latest vales just before processing it. Even then the result may not be good enough and you might end up having to analyze all the input that occurred between the previous frame and the current frame looking for certain patterns of input to prevent missing anything. Rewired does not offer either form of framerate-independent input at this time.

    How many Players is this user playing with when testing? If you're using the same saving/loading system I provided with the control remapping example, it saves XML mappings per-Player. If the user maps the Speedlink Torid with Player 0 and saves it, then the next time he plays he assigns that controller to Player 1, it will not load Player 0's mappings. That is the only thing I can think of that could be happening here. If not, you're going to have to debug log all the information both saved and loaded for the controllers to figure out at what point the save/load is failing.

    Thanks!
     
    DMeville likes this.
  7. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    400
    @guavaman Thanks so much for taking the time for such an in depth response, I appreciate it! I'll try out your suggestions!!
     
    guavaman likes this.
  8. nnurgle

    nnurgle

    Joined:
    Nov 22, 2014
    Posts:
    5
    I love rewired! I just purchased a Logitech g920 racing wheel and thought to myself, I wish I could control this thing from Unity. BAM! rewired already has it set up for me. Within seconds I was able to modify my favorite car controller to take input from my wheel! You sir, are a savior!

    I do have one question though... I see the documentation talking about vibration, but I don't know if or how one might be able to control the g920s steering wheel force feedback. Can you point me in the right direction?
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    :)

    Rewired does not support generic force feedback, only XInput (and DS4) gamepad vibration. Here's the answer from the FAQ: http://guavaman.com/projects/rewired/docs/FAQ.html#force-feedback

    You can control wheel force feedback with Logitech's plugin: https://www.assetstore.unity3d.com/en/#!/content/6630
     
  10. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I believe I have finally figured out how to consistently reproduce the scroll wheel not working. It seems to happen when I launch the game and focus another window while the splash screen is showing, wait until its finished loading, and switch back to the game. At that point scrolling does not work until I restart the game. I'm not sure if this is a problem with Rewired or with Unity though.
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Interesting set of circumstances to reproduce the bug. Please try it with the StandaloneInputModule instead of the RewiredStandaloneInputModule. Also, you could try it in a new project with a simple ScrollRect set up for testing and see if it's anything specific to your project causing it.

    Rewired does not modify the handling of scroll wheel input for any UI component. The source code for the StandaloneInputModule that executes the OnScroll event is as follows (Lines 16-20 in the code box):

    Code (csharp):
    1. // StandaloneInputModule.cs line 271
    2. // https://bitbucket.org/Unity-Technologies/ui/src/0155c39e05ca5d7dcc97d9974256ef83bc122586/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs?at=5.2&fileviewer=file-view-default
    3. protected void ProcessMouseEvent(int id)
    4. {
    5.   var mouseData = GetMousePointerEventData(id);
    6.   var leftButtonData = mouseData.GetButtonState(PointerEventData.InputButton.Left).eventData;
    7.   // Process the first mouse button fully
    8.   ProcessMousePress(leftButtonData);
    9.   ProcessMove(leftButtonData.buttonData);
    10.   ProcessDrag(leftButtonData.buttonData);
    11.   // Now process right / middle clicks
    12.   ProcessMousePress(mouseData.GetButtonState(PointerEventData.InputButton.Right).eventData);
    13.   ProcessDrag(mouseData.GetButtonState(PointerEventData.InputButton.Right).eventData.buttonData);
    14.   ProcessMousePress(mouseData.GetButtonState(PointerEventData.InputButton.Middle).eventData);
    15.   ProcessDrag(mouseData.GetButtonState(PointerEventData.InputButton.Middle).eventData.buttonData);
    16.   if (!Mathf.Approximately(leftButtonData.buttonData.scrollDelta.sqrMagnitude, 0.0f))
    17.   {
    18.     var scrollHandler = ExecuteEvents.GetEventHandler<IScrollHandler>(leftButtonData.buttonData.pointerCurrentRaycast.gameObject);
    19.     ExecuteEvents.ExecuteHierarchy(scrollHandler, leftButtonData.buttonData, ExecuteEvents.scrollHandler);
    20.   }
    21. }
    The same section of source code from the RewiredStandaloneInputModule (Lines 23-26 in the code box):

    Code (csharp):
    1. // RewiredStandaloneInputModule.cs, Line 675
    2. protected void ProcessMouseEvent(int id) {
    3.  
    4.     // Breaking change to UnityEngine.EventSystems.PointerInputModule.GetMousePointerEventData() in Unity 5.1.2p1. This code cannot compile in these patch releases because no defines exist for patch releases
    5. #if !UNITY_5 || (UNITY_5 && (UNITY_5_0 || UNITY_5_1_0 || UNITY_5_1_1 || UNITY_5_1_2))
    6.     var mouseData = GetMousePointerEventData();
    7. #else
    8.     var mouseData = GetMousePointerEventData(id);
    9. #endif
    10.     var leftButtonData = mouseData.GetButtonState(PointerEventData.InputButton.Left).eventData;
    11.  
    12.     // Process the first mouse button fully
    13.     ProcessMousePress(leftButtonData);
    14.     ProcessMove(leftButtonData.buttonData);
    15.     ProcessDrag(leftButtonData.buttonData);
    16.  
    17.     // Now process right / middle clicks
    18.     ProcessMousePress(mouseData.GetButtonState(PointerEventData.InputButton.Right).eventData);
    19.     ProcessDrag(mouseData.GetButtonState(PointerEventData.InputButton.Right).eventData.buttonData);
    20.     ProcessMousePress(mouseData.GetButtonState(PointerEventData.InputButton.Middle).eventData);
    21.     ProcessDrag(mouseData.GetButtonState(PointerEventData.InputButton.Middle).eventData.buttonData);
    22.  
    23.     if(!Mathf.Approximately(leftButtonData.buttonData.scrollDelta.sqrMagnitude, 0.0f)) {
    24.         var scrollHandler = ExecuteEvents.GetEventHandler<IScrollHandler>(leftButtonData.buttonData.pointerCurrentRaycast.gameObject);
    25.         ExecuteEvents.ExecuteHierarchy(scrollHandler, leftButtonData.buttonData, ExecuteEvents.scrollHandler);
    26.     }
    27. }
    The function call in both methods to get the mouse input data (including the scroll delta) which is then sent to event listeners is GetMousePointerEventData. GetMousePointerEventData exists in the PointerInputModule, which is the parent class of the StandaloneInputModule and the RewiredStandaloneInputModule. The PointerInputModule is built into Unity and is not replaced by the RewiredStandaloneInputModule or Rewired in any way. The PointerInputModule is responsible populating the event data that is sent to the UI element, in this case the ScrollRect when GetMousePointerEventData is called as follows:

    Code (csharp):
    1. // PointerInputModule.cs, Line 182:
    2. // https://bitbucket.org/Unity-Technologies/ui/src/0155c39e05ca5d7dcc97d9974256ef83bc122586/UnityEngine.UI/EventSystem/InputModules/PointerInputModule.cs?at=5.2&fileviewer=file-view-default
    3. protected virtual MouseState GetMousePointerEventData(int id)
    4. {
    5.     // Populate the left button...
    6.     PointerEventData leftData;
    7.     var created = GetPointerData(kMouseLeftId, out leftData, true);
    8.  
    9.     leftData.Reset();
    10.  
    11.     if (created)
    12.         leftData.position = Input.mousePosition;
    13.  
    14.     Vector2 pos = Input.mousePosition;
    15.     leftData.delta = pos - leftData.position;
    16.     leftData.position = pos;
    17.     leftData.scrollDelta = Input.mouseScrollDelta;
    18.     leftData.button = PointerEventData.InputButton.Left;
    19.     eventSystem.RaycastAll(leftData, m_RaycastResultCache);
    20.     var raycast = FindFirstRaycast(m_RaycastResultCache);
    21.     leftData.pointerCurrentRaycast = raycast;
    22.     m_RaycastResultCache.Clear();
    23.  
    24.     // copy the apropriate data into right and middle slots
    25.     PointerEventData rightData;
    26.     GetPointerData(kMouseRightId, out rightData, true);
    27.     CopyFromTo(leftData, rightData);
    28.     rightData.button = PointerEventData.InputButton.Right;
    29.  
    30.     PointerEventData middleData;
    31.     GetPointerData(kMouseMiddleId, out middleData, true);
    32.     CopyFromTo(leftData, middleData);
    33.     middleData.button = PointerEventData.InputButton.Middle;
    34.  
    35.     m_MouseState.SetButtonState(PointerEventData.InputButton.Left, StateForMouseButton(0), leftData);
    36.     m_MouseState.SetButtonState(PointerEventData.InputButton.Right, StateForMouseButton(1), rightData);
    37.     m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, StateForMouseButton(2), middleData);
    38.  
    39.     return m_MouseState;
    40. }
    The scroll wheel delta is taken directly from UnityEngine.Input.mouseScrollDelta. (Line 17 in the above code box.)

    Once the OnScroll event is executed, the ScrollRect is responsible for responding to that event and using the scroll delta to make the rect move:

    Code (csharp):
    1. // ScrollRect.cs, Line 268
    2. // https://bitbucket.org/Unity-Technologies/ui/src/0155c39e05ca5d7dcc97d9974256ef83bc122586/UnityEngine.UI/UI/Core/ScrollRect.cs?at=5.2&fileviewer=file-view-default
    3. public virtual void OnScroll(PointerEventData data)
    4. {
    5.     if (!IsActive())
    6.         return;
    7.  
    8.     EnsureLayoutHasRebuilt();
    9.     UpdateBounds();
    10.  
    11.     Vector2 delta = data.scrollDelta;
    12.     // Down is positive for scroll events, while in UI system up is positive.
    13.     delta.y *= -1;
    14.     if (vertical && !horizontal)
    15.     {
    16.         if (Mathf.Abs(delta.x) > Mathf.Abs(delta.y))
    17.             delta.y = delta.x;
    18.         delta.x = 0;
    19.     }
    20.     if (horizontal && !vertical)
    21.     {
    22.         if (Mathf.Abs(delta.y) > Mathf.Abs(delta.x))
    23.             delta.x = delta.y;
    24.         delta.y = 0;
    25.     }
    26.  
    27.     Vector2 position = m_Content.anchoredPosition;
    28.     position += delta * m_ScrollSensitivity;
    29.     if (m_MovementType == MovementType.Clamped)
    30.         position += CalculateOffset(position - m_Content.anchoredPosition);
    31.  
    32.     SetContentAnchoredPosition(position);
    33.     UpdateBounds();
    34. }
    The ScrollRect uses the delta received in the PointerEventData to change the scroll position and offset the UI elements.

    The ScrollRect is unmodified and no Unity UI components are replaced by Rewired (nor would this even be possible). Tracing through all the code responsible for making the ScrollRect scroll, no code has been changed at all by the RewiredStandaloneInputModule in passing the event data on to the ScrollRect. Based on this, I can see no way possible that this issue could be caused by the RewiredStandaloneInputModule.
     
  12. Little_Gorilla

    Little_Gorilla

    Joined:
    Oct 11, 2013
    Posts:
    69
    Hey Guavaman,
    I'm starting to put controller glyphs in my game and I'm wondering how to detect if a Steam controller is being used. It has the same GUID as an xbox360 (as confirmed in the documentation) so not sure how to make this work, unless I use a non-Rewired Steamworks function to check if a Steam controller is being used?

    Also, any tips for displaying keyboard glyphs other than a huge if/switch statement for keycodes?
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Steam Controller is not natively supported because Rewired does not make use of Steam's API. It can only be supported as an Xbox 360 controller unless you hit Steam's API directly.

    Keyboard glyphs are properly handled using an if or switch statement. Or if you set up a Dictionary using the KeyCode as a key, that would be an alternative.
     
    Last edited: Jan 19, 2017
    Little_Gorilla likes this.
  14. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    400
    I've been looking into this more (ran out and bought a Sony Dualshock 4 - the same model the player was having issues with). I can successfully reproduce the issue, but I'm not sure how to resolve this.

    Specifically it seems issue is caused by Steam - they introduced a new feature (not sure when) in their "Big Picture" mode. If you open that up and navigate to the settings icon (top right of the screen) in the "Controller Settings" menu, there is an option for "PS4 Configuration Support".

    With this turned OFF when I connect three controllers (PS4, Xbox, Xbox) they are assigned correctly to players 1,2, 3 (respectively)
    With this turned ON when I connect those same three controllers they are assigned to players 3, 4. I'm assuming player 5 is being assigned too (but this appears as if the controller isn't working because my game has no player 5).

    I'm not unplugging, changing, adding, or removing any controllers. The only thing I'm doing is toggling that option in Steam and restarting the game.

    Seems pretty weird, any idea? If you want to try it out shoot me a PM and I'll send you a key for Party Panic if it will help debug this issue, if it is indeed something that Rewired can solve. The game has a bunch of logging for Rewired already that you could inspect also if you want to try to look into it.

    Not sure what else I can try. For the meantime I can ask players to disable "PS4 Controller Support" in the Steam Big Picture settings for Party Panic only, but it would be cool to have it work properly under all situations.
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    This sounds very similar to another support issue I got via email, also Steam + DS4. Steam added native support for DS4 in December: http://www.theverge.com/2016/12/15/13965306/steam-ps4-dualshock-controller-support

    This throws another monkey wrench into the works. I do not know whether this native support for DS4 causes it to create another HID device visible to the program, Windows, both, neither, etc. I also do not know whether or not it makes the DS4 appear as an XInput device as it does with the Steam Controller. I would have to be able to test everything and observe how they are handling this.

    In all likelihood, if you check the number of devices appearing to Rewired, I'll wager it's seeing more than 3 devices when you have Steam's DS4 support enabled. The other duplicate / Steam-generated devices are probably being assigned to your Players.

    This is a Steam issue and nothing can possibly be done to "fix" or rather work around it without native Steam API access I'm afraid. Rewired does not implement any native Steam API library calls at the present time. As time goes on, Steam adds more and more hurdles to successful functioning side-by-side with non-Steam API aware systems and it's becoming increasingly obvious that I'm going to have to implement native Steam API access sooner or later. However, I have been unable to do anything because Steam has never given me a way to test anything within the Steam interface because I am not a Greelit game developer and they have no system in place for middleware developers to give them access to the developer console and to privately publish test apps. I have tried repeatedly to get in contact with someone who could get this sorted out over the past 3 years and have always been unsuccessful until this week. I cannot promise anything in the extremely near future, but hopefully I will be able to do something about this and other Steam-caused issues eventually.

    Depending on exactly what Steam is doing, the only hack I can think of is to make some kind of function you can call to disable HID support for DS4 controllers when the Steam option for DS4 support is enabled. This would have to be called by your code making a call to the Steam API to determine if that option is enabled. If it's doing what I think it's doing, this would make Rewired ignore real DS4 HID devices but probably still see the fake Steam DS4 HID/XInput device. But I will need to know exactly what it's doing first.
     
    Last edited: Jan 20, 2017
    DMeville likes this.
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    After testing your game, Steam indeed does create an XInput device for the DS4 when this option is enabled. The DS4 HID device is then blocked from sending any input, therefore you are left with a useless, non-working controller being assigned to a Player.
     
    DMeville likes this.
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    I've got my own AppId finally, so I am able to do some further testing.

    I have found that disabling "Use Steam Raw Input Fix" will make most things work as expected. Steam will hide the DualShock 4 HID device from Rewired and you will no longer get duplicated devices. It appears the Raw Input fix is no longer necessary because it was added a long time ago because of what must have been a bug in Steam. Steam would disable all Raw Input devices when a Steam Controller was attached. It no longer seems to do that. However, the fix would likely still be necessary for any game that needs to support more than 4 Xbox controllers simultaneously (must disable Use XInput) or they just don't want to use XInput for some reason.

    For your game, I think disabling "Use Steam Raw Input Fix" would probably be the thing to do. I will be disabling this option by default when creating a new Rewired Input Manager. I suggest that almost everyone disable this option now because it causes issues with Steam's DS4 configuration option and probably also with their other new generic controller configuration option as well. The only use cases where this option still makes sense is if you want to support XInput controllers but have Use XInput disabled and/or if you need to support more than 4 XInput controllers simultaneously (XInput must be disabled.)

    I have also noticed some new issues with regard to Steam emulated XInput device connection. The emulated devices do not send connection events to the window, so Rewired does not detect the devices. Time to add yet more Steam workaround hackery code... :eek:
     
    DMeville likes this.
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Rewired 1.0.0.111 is now available for download on the Rewired website for registered users. If you'd like to register to receive early access to updates, please contact me here. The update should be available on the Unity Asset Store in 3-10 days.

    Please be sure to read Updating Rewired before updating.

    In this update, the Steam Raw Input Fix option on Windows has been disabled by default. This will not disable the option for existing Rewired Input Managers. It is recommended that the majority of users disable the Steam Raw Input Fix in existing projects. Please see the release notes for more information.

    Release Notes:

    1.0.0.111:

    Changes:
    - Disabled "Steam Raw Input Fix" by default. It is recommended that this fix be disabled on almost all games. It causes issues with the new DualShock 4 configuration support in Steam. The fix is no longer needed for using Raw Input controllers together with the Steam Controller as Steam has fixed the bug for which this workaround was created. However, the option may still be useful for some use cases. Please see the tool-tip in the Rewired Input Manager Settings page for more details.
    - Added workaround for Steam not sending device notifications when emulated XInput devices are attached.
    - Added "Ignore Input When App Not In Focus" option to Rewired Input Manager Settings.
    - Control Mapper: When a popup window is opened and the user clicks on a non-selectable area, the currently selected UI element is no longer deselected.
    - Rewired Input Manager "Don't Destroy on Load" is now applied to root Game Object to avoid warnings in log if Rewired Input Manager is parented under another Game Object.

    API Changes:
    - Added ReInput.ConfigHelper.ignoreInputWhenAppNotInFocus property.

    New Controller Definitions:
    - Elecom Gamepad (JC-U3312)

    Bug Fixes:
    - Thrustmaster T.Flight Rudder Pedals: Fixed inverted mappings for L/R pedals.
    - Fixed issue when disconnecting and reconnecting a controller with calibrated axes that return non-zero values at rest.
     
  19. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    Thanks for this great update.

    Never heard of that Elecom Gamepad before now.

    I wish the asset store could release it today.
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    I've never heard of it before either. I picked it up on my recent trip to Tokyo. Kind of a work-related souvenir. :D
     
  21. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    I like that term. :)

    By the way I see that Deftly 1.1 was just released with Rewired support.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Very nice! Deftly is a great top-down shooter package. Having Rewired support included will be a great help for devs, especially for multi-player coop.
     
  23. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    So at some point will there be a 1.0.1.0? :p
     
    guavaman likes this.
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    :oops:

    I know... I haven't done the versioning very well. I'm kind of stuck with it now. :p
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Rewired 1.0.0.112 is now available for download by registered users. The Unity Asset Store should receive the update in 3-10 days.

    I've decided to release another minor update immediately which removes the "Use Steam Raw Input Fix" entirely as further testing shows that it no longer works due to changes to how Steam manages the system's access to controller information. The option was originally created due to a fairly major oversight in Steam which caused non-XInput controllers to stop working when a Steam Controller was attached also, but that has now been fixed. Because of conflicts with Steam's new optional DS4 and generic gamepad configuration systems, it's important that games no longer use the fix for best results so I've removed it.

    Please read Updating Rewired before updating.

    1.0.0.112:

    Changes:
    - Removed "Steam Raw Input Fix" option entirely due to recent changes in Steam making it non-functional.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    I wanted to make note of a new Unity UI bug I just discovered as I was doing some testing with Control Mapper.

    The bug:
    A UI Selectable that is set to non-interactible in the OnClick event will remain stuck in a Hover state which will only become visible once the Selectable is set to interactible again.

    Example:
    UnitySelectableHoverBug.gif

    The above example shows a simple scene with 2 Unity UI buttons. Each button sets itself to non-interactible and the other button to interactible when clicked. The hover color has been changed to red for clarity.

    If the mouse pointer is hovered over and then moved off the stuck button, the Hover state will be cleared and the color will return to the normal state.

    This affects Control Mapper's Player buttons, Category buttons, and the axis list in the calibration window.

    This bug does not exist in Unity 5.0.0, but does in 5.5.0. I don't know at what version it was added. I currently do not know of any solution to this issue. The bug has been reported to Unity.
     
    Last edited: Jan 21, 2017
  27. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    Do you have a Unity bug number for this issue?
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Case 872634
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Rewired 1.0.0.12 is now live on the Unity Asset Store!

    Be sure to read Updating Rewired before updating.

    Release Notes:

    1.0.0.112:

    Changes:
    - Removed "Steam Raw Input Fix" option entirely due to recent changes in Steam making it non-functional.

    1.0.0.111:

    Changes:
    - Disabled "Steam Raw Input Fix" by default. It is recommended that this fix be disabled on almost all games. It causes issues with the new DualShock 4 configuration support in Steam. The fix is no longer needed for using Raw Input controllers together with the Steam Controller as Steam has fixed the bug for which this workaround was created. However, the option may still be useful for some use cases. Please see Rewired Editor - Settings in the documentation for more details.
    - Added workaround for Steam not sending device notifications when emulated XInput devices are attached.
    - Added "Ignore Input When App Not In Focus" option to Rewired Input Manager Settings.
    - Control Mapper: When a popup window is opened and the user clicks on a non-selectable area, the currently selected UI element is no longer deselected.
    - Rewired Input Manager "Don't Destroy on Load" is now applied to root Game Object to avoid warnings in log if Rewired Input Manager is parented under another Game Object.

    API Changes:
    - Added ReInput.ConfigHelper.ignoreInputWhenAppNotInFocus property.

    New Controller Definitions:
    - Elecom Gamepad (JC-U3312)

    Bug Fixes:
    - Thrustmaster T.Flight Rudder Pedals: Fixed inverted mappings for L/R pedals.
    - Fixed issue when disconnecting and reconnecting a controller with calibrated axes that return non-zero values at rest.
     
    DMeville likes this.
  30. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,183
    is there a way to copy the settings between different projects? I'm creating a lite and a pro version of the same project and it has the same controls, I was hoping to copy some file with all the mapping info of keyboards/joysticks/etc without having to manually enter it again but I can't find the file that contains it
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Copy the Rewired Input Manager prefab/game object to the other project. (Edit: It no longer seems to work to use copy/paste on a scene object in Unity to another project or Unity Window). Create a prefab out of it first, then either export it to a Unitypackage (uncheck include dependencies) and import it in the other project or copy it in Windows Explorer / Finder with visible .meta files enabled and you copy those too at the same time. If you don't want to make a prefab, save the scene file and then copy that to the other project.

    EDIT: I've added a more detailed explanation on copying GameObjects to the documentation here.

    Further information:

    From Documentation - Input Manager

    How Data is Stored

    Unlike most input systems, Rewired does not store its input configuration data (maps, Actions, etc.) in a single location for the entire project. Instead, the data is stored in the current Rewired Input Manager game object. This means that you can have entirely different input setups for different scenes in your project if you like because each Rewired Input Manager is completely separate. It also means that input data is not globally available, especially in editor scripts or when Rewired has not been initialized.

    At runtime, the current input configuration is loaded from the active Rewired Input Manager in the scene. To change to a completely different input configuration, you can disable one Rewired Input Manager and enable another in the editor. (Make sure you only have one active any any time or all others will be disabled.) The Rewired Input Manager can also be made into a prefab and instances placed into each scene for a shared configuration.

    Unity Documentation on using Visible Meta Files:

    This is done by selecting Edit->Project Settings->Editor in the application menu and enabling External Version Control support by selecting Visible Meta Files in the dropdown for Version Control. This will show a text file for every asset in the Assets directory containing the necessary bookkeeping information required by Unity. The files will have a .meta file extension with the first part being the full file name of the asset it is associated with. Moving and renaming assets within Unity should also update the relevant .meta files. However, if you move or rename assets from an external tool, make sure to syncronize the relevant .meta files as well.
     
    Last edited: Jan 24, 2017
    creat327 likes this.
  32. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    We were hit by this issue too after updating, it seems to have been documented here and should be fixed in 5.6
     
    guavaman likes this.
  33. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    I hope Unity plans on porting their fix back to 5.5.x too.
     
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Thanks for the link. Looks like it caused many more problems than just the cosmetic issue based on the comments.
     
  35. longroadhwy

    longroadhwy

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

    Rewired is so much fun. I am really enjoying how easy it is to test out different input options without any real effort. Today I was testing out using flight pedals in Realistic FPS by @Azuline-Studios. I was using the left and right pedals for lean left and lean right and using the slide to switch weapons. You really have push hard for slide to switch weapons so you do not have to worry about accidentally changing weapons when leaning left or right. It makes it much easier when using a gamepad when you are running full speed and want to switch weapons but want to concentrate on running.

    Originally I was thinking of flight pedal slide for reloading but switching weapons is far more useful. Especially when used in combination with a gamepad which does not have as many buttons as flight controller (e.g. HOTAS). The additional benefit you can free up the d-pad (left and right) for something other than switching between weapons.
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    :D Haha! That's a creative use of flight pedals for sure. I love the idea and it makes me curious about all the other possibilities in other game genres of using multiple devices of various kinds.

    If you want to, you can tune the sensitivity required for activating the weapon switch by using the Input Behaviour -> Joystick Axis Sensitivity setting on the Input Behaviour assigned to your weapon switching Action. Or you could increase the sensitivity on the axis directly just for that device through calibration, which would automatically be available in Control Mapper.

    Thanks for sharing!
     
  37. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    The Flight pedals slide for switching weapons seems to work fine with the default sensitivity settings. I was more concerned with accidentally switching from a weapon to a flashlight in the middle of a fight. :) Actually rocker switch or a HAT on a HOTAS throttle might be a better choice.

    The HOTAS templates were a bit more involved when testing but using the throttle mini-stick seems to work but will need adjustments on the sensitivity side. The throttle mini-stick I am using it basically like you would use right stick on a gamepad. Originally I was thinking of using the 8 way POV HAT which is on most sticks to give users more flexibility if they only had a flight stick and not a throttle.

    For zoom feature on a sniper rifle I moved that to the throttle itself. That works well for simple throttle (slider) on the ThrustMaster T16000M joystick in addition to standard throttles like CH Pro Throttle and ThrustMaster TWCS throttle. It would be more work on a Saitek (now Logitech) X-55 throttle or Warthog throttle.

    The throttle dial on the CH Fighter Stick the zoom on the sniper rifle works very well also.

    For mapping the traditional gamepad buttons to HOTAS stick works nicely since they are so many options (button wise) when using the template. For Saitek (X-52, X-52 PRO, X-55), CH FighterStick, ThrustMaster Warthog you can get everything on the 2 main HATS without too much of a problem. The pinky button/trigger I mapped to throwing grenades and that seems to work fine. I was tempted to use some of the Stick's two stage triggers for grenades but that makes it too easy to throw a grenade when you are going the areas with limited spaces (e.g. tunnel).

    For the throttle I can see mapping the 3 most common weapons to some of the buttons to make easier than having to cycle through 10 different weapons in Realistic FPS.

    NOTE: Most of this is included in the Realistic FPS integration found here:

    https://forum.unity3d.com/threads/realistic-fps-prefab-released.176985/page-69#post-2921727

    It was tempted to try fitting a racing wheel into Realistic FPS situation. o_O The paddle shifters would be wonderful for switching between weapons. Only Saitek's Farm Simulation wheel I think would really work since it does have two sticks on the wheel itself plus buttons. The Farm Simulation wheel could be useful games (police chases type of games e.g. GTA) where you have both driving and running around in FPS mode. You could always use the accelerator pedal for sniper rifle zoom too.

    Actually @600 work in progress "Flashing Lights: Police, Fire, EMS" game seems like a good fit for the Farm Simulation wheel in this context. More information on that can be found in this thread.

    https://forum.unity3d.com/threads/flashing-lights-police-fire-ems.400788/
     
    Last edited: Feb 6, 2017
    600 likes this.
  38. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    The helicopter controller would make a good horse simulator controller (e.g. Horse Animset Pro) with a rider that has a weapon. The only downside is the helicopter controller is not self centering so being at rest (idle) might be an issue. But I think a HOTAS system would work perfect for a horse controller. The throttle would be great for controlling the speed of your horse. The throttle mini-stick for looking around and main stick for controlling where you are going and weapons.

    For a pinball game I think you could use a racing wheel. The paddle shifters could be used for the flippers and the accelerator pedal could be used for the Plunger. You could use the brake pedal for tilt also.
     
  39. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    6,511
    Is there a way to change keybindings at runtime from a script?I tried looking at the docs but could only really find anything for the rewired control mapper.
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Yeah, that would be something... But it would be very cool to be able to use any of those controllers as you go from vehicle to vehicle.

    I think using your feet to control the horse speed movement would be pretty cool and reasonably natural..

    Now that is a great idea!

    Thanks!
     
  42. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    That would be fun to be able to switch controls when you switch vehicles. You might need something like a lazy susan (https://en.wikipedia.org/wiki/Lazy_Susan) to move to the next control easily without having to physically move.

    A racing wheel might work perfectly in that context. You could use the pedals to control the speed. The accelerator for speed and the brake could be used to control direction (forwards or backwards). The paddle shifters could be used for jumping.

    I did see Pinball creator in the asset store (https://www.assetstore.unity3d.com/en/#!/content/74772) which looks like it would be a good asset to test out some of those ideas.
     
  43. Amalfi-Prozen

    Amalfi-Prozen

    Joined:
    Feb 2, 2014
    Posts:
    28
    Hi, I would disable keyboard for a player in real-time, How can do? (Is possible without disable map controller?)
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
  45. Amalfi-Prozen

    Amalfi-Prozen

    Joined:
    Feb 2, 2014
    Posts:
    28
    There's a problem, I would disable keyboard for a specific player (for example for player 2)!!!
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    As the documentation from the Controllers page states:

    Keyboard
    The keyboard works similarly to Joysticks in many ways, but there are a few notable differences:
    • At the present time, Rewired only supports a single, universal keyboard. Multiple keyboards attached to the system will simply act as a single keyboard.
    • Unlike Joysticks, the Keyboard does not and cannot be assigned to or deassigned from Players.
    • All Players have access to the Keyboard at all times.
    • Keyboards do not send connect/disconnect events.
    ---------

    There is no equivalent of assigning the keyboard to a Player like the mouse or joysticks. All players have access to the keyboard at all times and the only thing that controls whether any input is generated through the keyboard is the Keyboard Maps in the Player.

    It's super easy to disable a Player's keyboard maps:
    p.controllers.maps.SetAllMapsEnabled(false, ControllerType.Keyboard);

    I will change this in the next release so Player.controllers also has a hasKeyboard property like it does for the mouse for consistency.
     
    Last edited: Feb 6, 2017
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    I hadn't thought of that issue. Wires would become a big problem even with something like a Lazy Susan. Oh well. Having to get up and sit down at the racing wheel adds to the sense of immersion. :D
     
  48. Jasinka

    Jasinka

    Joined:
    Oct 18, 2016
    Posts:
    37
    Hello,

    Can you say or it's very hard configure rewired for novice unity user with no coding knowledge?

    And i can't find on your lost "GameSir G4s", it can be supported? Thank you very much.
     
  49. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    Moving to new controls would definitely help the immersion process. :cool:

    The racing wheel idea works really well with the horse controller. Using the Rewired racing wheel templates of course. I just did some tests with a racing wheel and it works fine. Using a paddle shifter for jumping works perfectly. For something like a 3D version of the Atari's Steeplechase it would be a really good fit. For combat while riding it should be there are enough buttons on the most popular wheels to handle that part I believe.

    Still have to spend some time on the racing pedals part to see how well that works.

    Force feedback would a great addition to combat while horse riding too. I was just looking at a Jousting video recently and thinking a racing wheel with force feedback would be great way to simulate it.

     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,921
    Rewired has extensive documentation which you can read to learn how to set it up.

    Documentation - Follow the guidelines on this page for what to begin with
    Documentation - Quick Start

    Rewired does require some knowledge of C# or knowledge of a visual scripting system (PlayMaker and Behavior Designer are supported.) You also need general knowledge of how input works in games. There are many tutorials on these topics for Unity (not related to Rewired) that show you how to do things like move characters, control cameras etc. They apply just as much to Rewired as to any input system, the only difference being what code you use to actually get input. There are also many concepts in Unity that you need to be familiar with and should learn before you attempt to use plugins such as Prefabs. Rewired's documentation assumes a basic knowledge of Unity and game development concepts.

    Get the free trial off the website. That's the easiest way to evaluate the software.

    Re: GameSir G4s:
    The GameSir G series controllers can all be used as XInput devicces on Windows so they will automatically just work. On Android, it is not explicitly supported so it can be used via user mapping or via enabling the "Support Unknown Gamepads" on Android option in the Rewired Input Manager.

    As stated on the Supported Controllers page here:

    All other controllers not listed above
    Any controller which does not have a hardware definition will be usable only through user mapping or by mapping actions to numbered axes and buttons in the Unknown Controller map. These unrecognized controllers can only be supported if you provide your users a way to remap their controls, such as by using the included Control Mapper or by creating a custom control remapping screen. If you do not provide users with a way to map their controls, only the above listed recognized controllers will be usable. If you do provide your users a way to map their controls, virtually any controller will be usable.
     
    Jasinka and DMeville like this.
unityunity