Search Unity

Rewired - Advanced Input for Unity

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

  1. invadererik

    invadererik

    Joined:
    Oct 31, 2010
    Posts:
    148
    Hi, I made a build on iOS using a SteelSeries XL (OS X). If I make the map using the SteelSeries template, then the Player doesn't read any input, I can get input from ReInput.controllers.GetAnyButtonUp(), and I've tried assigning all the controllers to the player to no avail. If I use the Dual Analog Gamepad template, the Player will read input, but its all mixed up some axis's return button inputs etc.

    Is there some setting I'm missing to get the SteelSeries template to work ?

    Any help would be appreciated, thanks!
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    This MAY BE determined by the AxisCalibration for the Axis in question. I say "may be" because this only applies if the actual hardware axis was calibrated from a -1 to +1 range to a 0 to +1 range by the hardware definition. If the underlying hardware actually returns a 0 to +1 range of values for the axis, this information would not be in the AxisCalibration because it was not modified by Rewired and there would be no way to get this information because the value is just allowed to come through as is. You would also never have this information in the case of an Unknown Controller, so it's best not to rely on having it.

    All flight sticks and HOTAS devices that Rewired recognizes have been calibrated to return a 0 to +1 range. Obviously, if you're using a gamepad stick for a throttle, it's going to be -1 to +1. Most unknown flight controllers will return a -1 to +1 range, which will need to be calibrated by the user to get it into a 0 to +1 range.

    It seems to me that the easiest solution is to use two Actions -- one for flight throttles and one for gamepad/keyboard throttle. They'd work completely differently -- the flight throttle Action would return the current value and the gamepad/keyboard Action would be additive slowly as you press up/down.
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Short version: Make your map for the Dual Analog Gamepad Template or the iOS MFI Gamepad.

    Documentation - Controller Maps - Special Considerations for MFI gamepads on iOS, tvOS, and OSX:


    Rewired supports many MFI gamepads on iOS, tvOS, and OSX. However, these platforms identify controllers differently so it affects which Joystick Maps are loaded.

    iOS/tvOS - All MFI-compatible gamepads are recognized simply as "iOS MFI Gamepad" and will load the "iOS MFI Gamepad" Joystick Maps you've created (if any). All MFI gamepads are supported. Joystick Maps created for specific controllers such as SteelSeries Nimbus will not be loaded and do not apply to iOS/tvOS.

    OSX - MFI-compatible gamepads cannot be automatically recognized as such and are identified on an individual basis like any other controller on OSX. Joystick Maps created for the specific controller will be loaded such as SteelSeries Nimbus. Joystick Maps created for the "iOS MFI Gamepad" will not be loaded on OSX.

    In order to provide coverage for all supported MFI and other gamepads, simply create your Joystick Maps for the Dual Analog Gamepad Template and they will work across platforms. By using the template, you don't have to worry about any of these platform-specific issues.

    What version of Unity is this?

    All MFI gamepads have the exact same layout which is why there is a single definition that matches all controllers. Unless Unity or Apple decided to suddenly remap the button and axes internally and break compatibility with all existing games, the buttons and axes are fixed and on MFI controllers on iOS. I suggest double checking your assignments in the Dual Analog Gamepad Template.

    Can you tell me exactly which elements are wrong and what they're mapping to?
     
    Last edited: Sep 28, 2016
  4. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    There is a problem with that, let's say I create "ThrottleGamepad" and "ThrottleFlight" actions. If I have to check both all the time, they both will return 0 unless I move them. So I have no idea whether the gamepad is static (not moving) or whether it's a throttle from flight stick set to 0 power. Or is there a way to know whether the input is coming from gamepad or flight stick?
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    There is no way to directly determine if a stick is a "Flight Stick" or a "Gamepad" without checking for specific controller Guids. That wouldn't be a fool-proof method anyway, again because Unknown Controllers would not be knowable.

    Instead, you do something like this:

    Code (csharp):
    1. private float additiveThrottleSpeed;
    2. private float additiveThrottle;
    3.  
    4. // Get the current throttle value. Handles flight throttles (0 to +1 range) and gamepad/keyboard/button throttles (value remains fixed until a positive or negative value is added to)
    5. float GetThrottleValue() {
    6.  
    7.   float gamepadThrottle = player.GetAxis("Additive Throttle");
    8.   float flightThottle = player.GetAxis("Throttle");
    9.  
    10.   // Handle throttle differently if user is using a flight stick or a gamepad/keyboard/button
    11.   if(!Mathf.Approximately(flightThottle, 0f)) { // a throttle axis that returns 0 to 1 is active
    12.  
    13.       // Direct throttles override additive throttles if active
    14.       additiveThrottle = 0f; // clear the additive throttle when the flight throttle is set to non-zero in case the user has both a gamepad and a flight stick plugged in because we don't want the additive throttle popping back on when the flight stick throttle is set to 0.
    15.  
    16.       return flightThrottle; // just return the actual throttle axis value
    17.  
    18.   } else { // this is an additive throttle
    19.  
    20.     // Ramp up/down the additive throttle over time
    21.     if(!Mathf.Approximately(gamepadThrottle, 0f)) {
    22.         additiveThrottle = Mathf.Clamp01(additiveThrottle + (gamepadThrottle * additiveThrottleSpeed * Time.deltaTime));
    23.     }
    24.     return additiveThrottle;
    25.   }
    26. }
     
    Last edited: Sep 28, 2016
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    @creat327 You also might consider making 3 Actions:

    Throttle - Axis type Action
    Throttle Up - Button type Action
    Throttle Down - Button type Action

    Then on the flight sticks, map the throttle to Throttle.
    For gamepads, map the Left Stick Up to Throttle Up and Left Stick Down to Throttle Down.
    For keyboards, up key to Throttle Up and down key to Throttle Down.

    This might make user remapping easier / more clear. Also, button type Actions can still be queried by GetAxis. It's just a hint for mapping.
     
    Last edited: Sep 28, 2016
  7. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Thanks, I can try the Throttle, Up, Down... but still I have the problem how to distinguish if GetAxis("Throttle") is returning 0 because the engine is off or because there is no value to be returned (no controller returning anything there). In short, I don't know whether I should turn off the engine or ignore that returned 0 because it's not coming from anything
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Wouldn't this problem be solved by the code I posted above?

    If GetThrottleValue() == 0 it means:
    If a flight throttle is attached, it is set to 0 input.
    If a gamepad/key/button throttle is being used, it is also set to 0 input.

    If a flight throttle is non-zero, the returned value is non-zero.
    If a gamepad/key/button throttle, the value is non-zero if the user has set any positive throttle amount. That throttle amount remains constant until the user lowers it.

    If GetThrottleValue is 0, turn off the engine. If not, leave it on. Does this make sense for your use case?
     
  9. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    I believe this did the trick
    public float getSpeed(float currentSpeed) {
    // returns a speed between 0 and 1 (percentage)
    if (player.GetButton("Up Throttle"))
    {
    return currentSpeed + Time.deltaTime;
    } else if (player.GetButton("Down Throttle"))
    {
    return currentSpeed - Time.deltaTime;
    }
    if (player.IsCurrentInputSource("Throttle", Rewired.ControllerType.Joystick)) {
    return currentSpeed + (player.GetAxis("Throttle") * Time.deltaTime);
    }
    return currentSpeed;
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    I don't understand why checking if the input source is a joystick is necessary. I also don't understand why you would be adding the joystick throttle's value to currentSpeed * Time.deltaTime.

    I was under the impression your control scheme was as follows:
    1. If using a flight stick throttle, use the actual value of the throttle (0 - 1) for your final throttle speed.
    2. If using a gamepad stick/key/button, the throttle value remains set to the last known throttle value and the throttle value is increased/decreased based on user input on that throttle. When the gamepad stick/key/button is 0, the throttle value remains at the last known value.

    The code I posted does that and has these advantages:
    1. No need to check the Action input source type.
    2. Flight stick throttles use the actual current throttle value instead of a value modified over time by Time.deltaTime.
    3. Change in throttle speed when using a gamepad stick is variable based on how hard the user is pressing on the stick.

    If you wanted to use my code modified to use 3 Actions, it would look like this:

    Code (csharp):
    1. public float additiveThrottleSpeed = 1f; // set in inspector
    2. private float additiveThrottle; // the last known additive throttle value
    3.  
    4. // Get the current throttle value. Handles flight throttles (0 to +1 range) and gamepad/keyboard/button throttles (value remains fixed until a positive or negative value is added to)
    5. float GetThrottleValue() {
    6.  
    7.   float flightThottle = player.GetAxis("Throttle");
    8.   float throttleUp = player.GetAxis("Throttle Up");
    9.   float throttleDown = player.GetAxis("Throttle Down");
    10.  
    11.   // Handle throttle differently if user is using a flight stick or a gamepad/keyboard/button
    12.   if(!Mathf.Approximately(flightThottle, 0f)) { // a throttle axis that returns 0 to 1 is active
    13.  
    14.       // Direct throttles override additive throttles if active
    15.       additiveThrottle = 0f; // clear the additive throttle when the flight throttle is set to non-zero in case the user has both a gamepad and a flight stick plugged in because we don't want the additive throttle popping back on when the flight stick throttle is set to 0.
    16.  
    17.       return flightThrottle; // just return the actual throttle axis value
    18.  
    19.   } else { // this is an additive throttle
    20.  
    21.     // Ramp up/down the additive throttle over time
    22.     if(!Mathf.Approximately(throttleUp, 0f)) {
    23.         additiveThrottle = Mathf.Clamp01(additiveThrottle + (throttleUp * additiveThrottleSpeed * Time.deltaTime));
    24.     }
    25.     if(!Mathf.Approximately(throttleDown, 0f)) {
    26.         additiveThrottle = Mathf.Clamp01(additiveThrottle - (throttleDown * additiveThrottleSpeed * Time.deltaTime));
    27.     }
    28.     return additiveThrottle;
    29.   }
    30. }
     
    Last edited: Sep 28, 2016
  11. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    thanks I'll give that a try
     
  12. Emi_Aran

    Emi_Aran

    Joined:
    Sep 28, 2016
    Posts:
    3
    Hi Guavaman! great work with rewire. I want to know if it works well in parallel with google vr controls wich are triggered with the cellphone sensors or there are some issues? i want to plug in a gamepad to the phone (im using an xbox 360 gamepad that works well, but not other more generic gamepads)
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    I do not know how Google VR controls work, but Rewired is not going to conflict with it because Rewired uses UnityEngine.Input for the input source on Android.

    >> ...but not other more generic gamepads

    Please see this to understand how controller recognition and support works in Rewired.

    Also see this about generic gamepad support on Android.
     
  14. Emi_Aran

    Emi_Aran

    Joined:
    Sep 28, 2016
    Posts:
    3
    I havent installed rewired yet, thats with the standard unity input manager
     
  15. Emi_Aran

    Emi_Aran

    Joined:
    Sep 28, 2016
    Posts:
    3
    Thanks for the quick reply!
    Cheers
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Oh I see. Thanks for the clarification!

    Edit: The Android generic controller link was wrong. I fixed it.
     
  17. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    Hi,

    I have a question, a rare behaviour that I suspect it's NOT related to rewired, but I want to ask you just in case...

    I have 2 ps3 controllers in windows 10. Using the scp drivers. The gamepads works perfectly fine and rewired recognises them and can be used within the game.
    The thing is that I don't receive any callback from them regarding connection or disconnection. I suspect that the way the driver was done it's not notifiying the system properly (maybe not xinput or a workaround from the driver).
    It's a little bit annoying because obviously I cannot test a "controller disconnection" situation or viceversa...

    I DON'T consider this a rewired bug unless you state something different...
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Hi,

    Rewired relies on Windows device notification events to detect controller connection and disconnection. If you're not receiving disconnection events when you disconnect a controller, that means Windows isn't sending any events. If you look in the Bluetooth device manager in Windows and you see the controller still says "Connected" or something of the sort, it means the driver didn't tell Windows that the device was disconnected. If this happens, the joystick is still going to appear in Rewired. (Look at the Rewired Input Manager -> Debug Info to see what Joysticks Rewired sees.)

    If the joysticks are showing up in Rewired when attached before starting the game but never sending events, it's very likely that if you had the devices disconnected before starting the game and then try to connect them that they wouldn't show up. Unfortunately, if Windows or the driver isn't sending device events, it's outside Rewired's ability to control.

    Rewired even has extra measures in place to try to get disconnection notices in other ways for certain special cases like buggy Steam controller disconnection in some versions of the firmware/driver and for faulty Bluetooth devices that don't disconnect properly, yet none of the above works for the DS3 + scp apparently.
     
    Last edited: Sep 29, 2016
  19. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    Thanks a lot!!!, just what I thought... probably the driver it's not notifying the system about the changes. I get the windows popups (related to the plugin) about a controller connected, but that's all. In my case it's usb direct connection, I don't use the bluetooth dongle.
    Anyways I will try to buy some x360/xone controllers that works perfectly fine in order to test the "disconnection routines" :)
    Thanks for your time :)
     
  20. ISH_the_Creator

    ISH_the_Creator

    Joined:
    May 8, 2013
    Posts:
    165
    Is it possible to map 2 buttons to one action. For example

    Ufc fighting. Hold left trigger to crouch then button 1 or an 2 for right uppercut. Or left trigger and 1 for low right hook

    Left trigger 3 and or 4 for low left uppercut. Or 3 for low left hook

    Left trigger and top left trigger and button 1 for right low kick. Left trigger and top left trigger and button 1 and 2 for low

    Right high leg kick. Using playmaker or similar (motion controller or third person shooter from opsive)

    ?

    Just bought can't wait to dig in
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Hi,

    From How To's - Handling multi-button Actions:

    Rewired does not currently have a way to bind multiple Controller elements to a single Action except for keyboard modifier keys and indirectly through the use of Custom Controllers. To handle button combos, they should be handled in code based on your individual needs (timings, which needs to be pressed first, what cancels what out, etc). In these cases, it can help to think of it as if you're using Actions as buttons:

    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. }
    The constituent Actions can be remapped by the user freely and nothing breaks. You also don't have to worry about the complexities of trying to allow the user to remap actual physical button combos for an Action and worrying about what else may already mapped to the constituent buttons. In addition, this kind of Action combo will work across multiple Controllers and Controllertypes since Rewired's Player-based input system is largely controller agnostic.

    ----------------------

    In PlayMaker or Behavior Designer you would use one of their conditional "And" actions to link the results of a GetButton and a GetButtonDown together.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    No problem! I will try installing the driver and see what results I get.
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    @Eskema

    I tested it and get the same result as you. Not only does it not send events, it actually keeps the XInput device active seemingly forever after the device has been disconnected. As far as XInput and Rewired are concerned, the device is still connected and active even when unplugged. Quitting and restarting Unity doesn't change anything because the driver is reporting at the XInput level that the device is still attached. This is definitely an issue with the driver.
     
  24. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    just what we thought... maybe it's just a bug, or maybe it's a hack they had to do in order to get the drivers working on windows...
    Because the driver itself through their app scpmonitor it reports that the controller was connected or disconnected, but they are not passing that info to xinput...

    Anyways at least the controllers works with rewired which is good :)
     
  25. ISH_the_Creator

    ISH_the_Creator

    Joined:
    May 8, 2013
    Posts:
    165
    I understand that kinda, And thanks for responding :)
     
  26. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Hey Guavaman! Hope you are well.

    I need a little help, please. A few of my Steam users cannot click on the first menu of my game. Nothing works at all. No input at all. ( They cannot get past a simple "continue" button in a Unity UI ).

    I have many of other users that have NO problems at all. I myself can not recreate the bug on my end. The only way I can recreate the problem is to check the "disable input" Toggle in the settings menu. (i accidentally toggled it a long time ago and caused myself a day of hair pulling.... but lets not talk about that. haha)

    I AM using Steamworks.net and have loaded the RewiredInputManager into the scene a full two seconds before I initialize steamworks.net plugin. I saw the known issues on your site. I have been working with a couple users for a few days now and wondered if you had any ideas or advice on what it may be.

    All users claimed they unplugged all controllers and use only USB Mouse and keyboard. They still cannot get past the first button in the game.

    Specs:
    Windows 10
    USB Mouse
    USB Keyboard
    No controllers connected.

    Here is a screen grab of the main settings.

    Once again....Thanks for any advice and an AMAZING product.
    Kevin

     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Hi,

    I can see from the screenshot you posted that you're using quite an old version of Rewired -- at the very least 16 versions behind, because there are no per-platform settings which were added in 1.0.0.88. The current version is 1.0.0.103. The first thing you should do is update to the current version.

    I would have to see how this Unity UI button is set up. I'm assuming you're using the RewiredStandaloneInputModule then -- I need to see all the settings on that. And how is this button's activation being handled? I'd need to see the script code that it's supposed to be run. Did the users try with a gamepad initially (which one)? Does your button even support gamepad input? Is it set up to be auto-selected initially?

    Have you gotten any log files from any of these users? If this has anything to do with an error in Rewired, something would be logged. There are so many things this could be and many are not even related to Rewired. I really need more to go on to formulate any kind of theory.

    Based on one past support issue, again a cryptic problem with a Unity UI button, if you have disabled "Allow Mouse Input if Touch Supported" on the Rewired Standalone Input Module and these users are on a touch-screen PC, mouse input will be ignored. But it would still work with a recognized and mapped gamepad, provided you've set everything up correctly for gamepad UI input and the button starts as the selected object in the Event System.

    Glad you like it!
     
    Last edited: Sep 30, 2016
  28. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Ok. Thank you. Ill get more info and will try a few ideas that you have given me.

    I have updated to the latest version of Rewired. I have been just using the old one successfully so I didnt change anything. The new one update FLAWLESSLY :) Nice job.

    I was using the RewiredStandaloneInputModule but I have now removed it. ( I really wasnt using it anyway as I did not fill in any of the actions on the script.). Im thinking this may be the problem. I simply forgot about it and put it on the TODO list. I have resorted to the Unity default setup.

    Im now going to have the user reset all their player prefs. As you gave me an idea that it may have loaded a gamepad or something and saved the settings and is now not loading it. I have a button in game that will delete all keys and my game will set them up next time they start the game.

    Ill report back when I find the problem in case anyone else has this weird problem.

    Thanks again

    EDIT: I also forgot to mention that I had player Log files turned off for that build and have turned them back on to get some more data. Ill keep ya posted. :)
     
    guavaman likes this.
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Rewired 1.0.0.104 is now available for registered users to download from the website. If you would 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 business days.

    Please be sure to read Updating Rewired before updating.

    Release Notes:

    1.0.0.104:

    Changes:
    - Added option to to disable Input.location property in UnityInputOverride.cs in Global Options window.
    - Added option to to disable Xbox gamepad vibration support in Global Options window.
    - Added options to Control Mapper to allow disabling of full-axis and/or split-axis input assignment fields for axis-type Actions.

    Integration Changes:
    - PlayMaker:
    New Actions:
    RewiredGetPlayerIds
    RewiredGetAllPlayerIds
    RewiredGetJoystickIds
    RewiredGetCustomControllerIds
    RewiredIsControllerAssigned
    RewiredIsControllerAssignedToPlayer
    RewiredRemoveControllerFromAllPlayers
    RewiredAutoAssignJoystick
    RewiredAutoAssignJoysticks
    RewiredControllerPreDisconnectEvent
    RewiredPlayerGetJoystickIds
    RewiredPlayerGetCustomControllerIds
    RewiredPlayerAddController
    RewiredPlayerRemoveController
    RewiredPlayerContainsController
    RewiredPlayerClearControllerMaps
    RewiredPlayerLoadDefaultMaps
    RewiredPlayerLoadControllerMap
    RewiredPlayerRemoveControllerMap
    RewiredPlayerGetExcludeFromControllerAutoAssignment
    RewiredPlayerSetExcludeFromControllerAutoAssignment
    RewiredControllerGetId
    RewiredControllerGetName
    RewiredControllerGetTag
    RewiredControllerSetTag
    RewiredControllerGetHardwareName
    RewiredControllerGetType
    RewiredControllerGetIsConnected
    RewiredControllerGetButtonCount
    RewiredControllerGetHardwareIdentifier
    RewiredControllerGetMapTypeString
    RewiredControllerGetAxisCount
    RewiredControllerGetAxis2DCount
    RewiredJoystickGetUnityId
    RewiredJoystickGetHardwareTypeGuidString
    RewiredJoystickGetSupportsVibration
    RewiredJoystickGetVibrationMotorCount

    *** BREAKING CHANGES ****
    Changed the following Actions to use FSMEnum instead of FSMInt for controllerType property:
    RewiredGetLastActiveControllerType
    RewiredControllerConnectedEvent
    RewiredControllerDisconnectedEvent
    RewiredPlayerRemoveControllers
    RewiredPlayerGetLastActiveControllerType

    - Behavior Designer:
    New Actions:
    RewiredGetPlayers
    RewiredGetAllPlayers
    RewiredGetJoysticks
    RewiredGetCustomControllers
    RewiredIsControllerAssigned
    RewiredIsControllerAssignedToPlayer
    RewiredRemoveControllerFromAllPlayers
    RewiredAutoAssignJoystick
    RewiredAutoAssignJoysticks
    RewiredControllerPreDisconnectEvent
    RewiredPlayerGetJoysticks
    RewiredPlayerGetCustomControllers
    RewiredPlayerAddController
    RewiredPlayerRemoveController
    RewiredPlayerContainsController
    RewiredPlayerClearControllerMaps
    RewiredPlayerLoadDefaultMaps
    RewiredPlayerLoadControllerMap
    RewiredPlayerRemoveControllerMap
    RewiredPlayerGetExcludeFromControllerAutoAssignment
    RewiredPlayerSetExcludeFromControllerAutoAssignment
    RewiredControllerGetId
    RewiredControllerGetName
    RewiredControllerGetTag
    RewiredControllerSetTag
    RewiredControllerGetHardwareName
    RewiredControllerGetType
    RewiredControllerGetIsConnected
    RewiredControllerGetButtonCount
    RewiredControllerGetHardwareIdentifier
    RewiredControllerGetMapTypeString
    RewiredControllerGetAxisCount
    RewiredControllerGetAxis2DCount
    RewiredJoystickGetUnityId
    RewiredJoystickGetHardwareTypeGuidString
    RewiredJoystickGetSupportsVibration
    RewiredJoystickGetVibrationMotorCount
    RewiredObjectListGetCount
    RewiredObjectListGetItemAtIndex
    RewiredObjectListForEach

    *** BREAKING CHANGES ****
    Changed the all Tasks to use ControllerType Enum instead of int for controllerType property.

    Bug Fixes:
    - When the keyboard is disabled on Android, special keyboard keys are no longer skipped when evaluating Keyboard Maps.
     
    Last edited: Oct 2, 2016
    devotid likes this.
  30. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Two questions:
    1) On android, I disabled the keyboard support to skip all the checks as recommended. But then I have the problem that I can't detect the Back key since Unity seems to map it to Keyboard.Escape key code. Is there a way to disable all keyboard checks except for that Back key on android?

    2) Is there a way to disable/enable keyboard support in game? I have a chat system that popups in the middle of the game so I don't want the awsd keys combinations to work while I'm typing in the chat and I want to enable back the keyboard when they close the chat popup.
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    1) No there is no way to disable individual keyboard keys. Certain keys are left enabled on Android even when the keyboard is set to disabled because system buttons or gamepads use them. The following keys are never disabled on Android:
    Escape
    Menu
    F2
    Up Arrow
    Right Arrow
    Down Arrow
    Left Arrow

    Edit: I have just retested because of your report and the Escape key is indeed still registered on Android when keyboard input is disabled.

    Edit 2: While the keyboard keys were still passed through, I found a bug that caused the keyboard maps not to be evaluated on Android when they keyboard is disabled. Fixing it in the next release.

    Edit 3: Since nobody has downloaded 1.0.0.104 yet, the update has been released in 1.0.0.104 and resubmitted to the Asset Store. It's available now on the website for registered users.

    If you need other specific keys to work, you can always call UnityEngine.Input.GetKey.

    2) Troubleshooting - Joystick buttons activate keyboard keys on Android
    http://guavaman.com/projects/rewire..._ReInput_ControllerHelper_keyboardEnabled.htm

    You could also enable and disable controller maps. A better solution would be to simply disable all input by setting and checking the current user state. Do not call your input routines when the user is in the chat window state.
     
    Last edited: Oct 2, 2016
  32. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    I'm having issues with Logitech G27 Racing Wheel. It seems to be mapping to Unknown Controller and yet the assigned joystick correctly says G27 Racing Wheel when I query rewiredPlayer.controllers.Joysticks[0].name.

    I have Logitech Gaming Software 8.75.30 installed. Logitech seems to have dropped all support for any wheels prior to G920 so the G27 doesn't show up in the Logitech software. However the G27 does show up in Windows 10 Hardware and Printers. In Win10, when I look at G27 Racing Wheel properties the steering wheel, pedals, and most buttons respond ok in Win10 - just not in Rewired. The wheel works fine in other games outside Unity.

    I'm on 1.0.0.102.U5. Is there any way I can get the G27 to use the correct joystick map?
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    You cannot force it to match the existing G27 definition because if it's not matching, they must have changed something important in the driver which makes it no longer match to the expected layout or identifying information.
    1. Create a Rewired Input manager in the scene.
    2. Set the input sources to match whatever you intend to use in your game.
    3. Drag the Rewired/DevTools/JoystickElementIdentifier prefab into the scene at 0, 0, 0.
    4. Press play to see a readout of joystick elements.
    5. Send me a screenshot.
    The name returned in the Joystick.name is always the Product Name provided by the HID device for unrecognized controllers. If the controller is recognized, the name defined in the hardware definition is used instead. "G27 Racing Wheel" is the product name the device is reporting.

    The controller is not recognized, but that doesn't mean it does not work. The elements will respond to button presses and axis movements as an Unknown Controller. If your game does not provide a way for users to map their controls, then no, the controller won't work at all. If it does, then it can be mapped by the user and still used. This isn't an issue of the device not functioning in Rewired, just not being recognized and matched to the pre-defined hardware definition so your Controller Maps can be loaded.
     
    Last edited: Oct 5, 2016
  34. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    Is there a method that tells me which Joystick map is currently in use? e.g. Unknown Controller, Logitech G27 etc.?
     
  35. L-W

    L-W

    Joined:
    Mar 3, 2013
    Posts:
    20
    Hello Guavaman! I'm having a very similar issue to devotid (he last posted on Friday), I am unable to use a simple Xbox 360 controller to navigate the Unity UI via your RewiredStandaloneInputModule system.

    I decided to create a package that reproduces the issue. I created a basic UI out of three buttons, set one of them as the "First Selected" then replaced the StandaloneInputModule with RewiredStandaloneInputModule. I then created "UIHorizontal" "UIVertical" "UISubmit" and "UICancel" actions in the Rewired Input manager for "Dual Analog Gamepad", "Unknown Controller" and "Xbox 360 Controller" and the issue persists.

    I'm unsure where to go from here, but if it helps, I'm using Unity 5.4.0f3 and Rewired version 1.0.0.103.

    I'd love to share the repro package via a dropbox link but I'll only do it via PM (the package contains your asset, don't want to share it publicly).

    Any assistance you could provide would be greatly appreciated, and please let me know if I can do anything further!
     
    Colin_MacLeod likes this.
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Controller Maps do not have names. They are loaded based on the Joystick type. Joystick.hardwareTypeGuid is the information you use to determine whether the controller is recognized -- all 0's is Unknown Controller. This information is visible in the Debug Information popout in the Rewired Input Manager inspector at runtime. It will tell you whether the controller is recognized or not.
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Please PM me the link or use the support form on the website and I will take a look.

    A working UI example is included in the ControlMapper/Examples folder. If this works on your system, then it's a controller mapping setup issue or incorrect settings in the Rewired Standalone Input Module inspector.
     
    Last edited: Oct 5, 2016
  38. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Can you downgrade the driver or do you need it for support of other Logitech devices?

    http://support.logitech.com/en_us/software/lgs

    When I checked the latest driver in the supported products list it does not include the G27.

    • Software Version: 8.88.30
    • Post Date: Oct 04, 2016
    • OS: Windows 8, Windows 7, Windows 10
    • File Size: 79.4 MB

    =================================================
    However when I look for specific drivers for the G27 racing wheel I find this driver. You can still download this driver from the URL listed below. I found it to be the last Logitech driver in the list.

    http://support.logitech.com/en_us/product/g27-racing-wheel#download

    • Software Version: 5.10.127
    • Post Date: 14-MAR-2016
    • OS: Windows 8, Windows 7, Windows Vista, Windows XP (or older), Windows 10
    • File Size:14.4 MB
    and supported products list ...
    • Attack 3 Joystick
    • Cordless Rumblepad 2
    • Driving Force EX
    • Driving Force GT
    • Driving Force Pro
    • Dual Action Gamepad
    • Extreme 3D Pro
    • Flight System G940
    • Force 3D Pro
    • Formula Force EX
    • Freedom 2.4 Cordless Joystick
    • G25 Racing Wheel
    • G27 Racing Wheel
    • Gamepad F310
    • Logitech® MOMO® Racing Force Feedback Wheel
    • MOMO Force
    • NASCAR Racing Wheel
    • Precision Gamepad
    • Rumble Gamepad F510
    • Rumblepad 2
    • Wireless Gamepad F710
    ==========================================

    Based on the Logitech support fourm the issue is the driver has to be reinstalled. iRacing software had the same issue.

    https://community.logitech.com/s/feed/0D53100005403WFCAY

    See this URL for the same issue.

    http://boxthislap.org/g27-not-working-after-windows-10-update/
     
    Last edited: Oct 5, 2016
    sstrong and CarterG81 like this.
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    @longroadhwy

    Thanks! That's very valuable information!

    I have fixed @sstrong's issue by adding a variant for the G27 that supports it when no driver is installed. However, without a driver, some of the elements on the device do not work like the clutch pedal, the shifter, and some of the buttons. There's no way to make these work without a driver, so your solution is even better.
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
  41. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    For others, this occurs when you install a "newer" version of Logitech Gaming Software like 8.75.30 because Logitech assume everyone will replace older G25 and G27 steering wheels with the current G920 wheel for PC/Xbox One (or the G29 for PlayStation 4).
     
    guavaman likes this.
  42. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    It is a little off-topic for Rewired, but in Nov 2015 we did some testing with a Logitech dev around the Logitech SDK for force feedback etc. on Logitech steering wheels (G25/G27/G290 etc.). We didn't really end up with a viable solution - just wondering if anyone else got the Logitech SDK to work correctly with Unity 5.x.
     
  43. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Have you seen this topic? This is mainly about the Logitech Gaming SDK. The forum topic name is not obvious that is what it is discussing.

    https://forum.unity3d.com/threads/unity-editor-crashes-with-native-plugin-on-stop.315884/

    There is also this one.

    https://forum.unity3d.com/threads/force-feedback-for-windows.78268/#post-2543068
     
    Last edited: Oct 7, 2016
  44. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    Yes, just wondering if anyone in this forum had actually found a solution for setting the properties without crashing Unity.
     
  45. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    For the Unity asset Logitech Gaming SDK (https://www.assetstore.unity3d.com/en/#!/content/6630) which version are you using the older one or the new one? What version of Unity are your running? What version of Windows are running and also is it 32-bit or 64-bit? Are you building a 32-bit or 64-bit application?

    When I was looking at the normal Logitech Gaming SDK (i.e. LogitechSteeringWheelSDK_8.75.30.zip) which looks interesting since it claims G27 wheel support with a newer driver. It was built with Visual Studio 2010. It supports C/C++ and also has a C# which makes it more interesting.

    You can download that from this URL: http://gaming.logitech.com/en-us/developers

    I was going to test that out with a Logitech G27 wheel and see if I have any issue with that as a standalone using VS 2013. I am running on Windows 8.1 (64-bit). It might be easier to wrap that newer DLL and use that with Unity rather than the Logitech Game SDK asset which is an older version.
     
  46. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    Win10 Pro x64
    Just re-tested the Unity Logitech Gaming SDK 1.6 wrapper for steering wheel. Editor still crashes when properties are updated (using their project...). From discussions we had with Logitech last year, I believe this is because it is expecting properties from G29/G290 steering wheels only. AFAIK there is no plan by Logitech to provide backward compatibility with G25/G27 wheels because they want everyone to purchase their new products :). I haven't tested this code with a G290 wheel (I assume it would work).
    Last year we tried to get the SDK (8.75.30) to work with Windows 10 UWP (VS 2015?) - but this failed for similar reasons. From what I recall, working the Logitech dev we did manage to get a version that didn't crash but still didn't end up with a solution.
     
  47. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Im currently using Unity 5_4_0 with Rewired 1.0.0.104 and Logitech 1.6. with FFB. It works great..... BUT I too get the Crash still.
    I have just resorted to having the customer set their Global Rotation and the Gain/Smoothing before opening the game. Its a shame we cant have a simple working SDK for a generic FFB dll. (Think servo motors, interactive exhibits and other uses etc) I have been making Force feedback games for 4-5 years and have had problems the whole time. I would have thought someone would have filled that void by now. There are many good wheels now for under 200 bucks. :/
     
  48. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    If Logitech was trying to avoid supporting old products I am wondering why Logitech purchased the Saitek from MadCatz recently? :) Most of the Saitek product line is really old. Most people keep their flight simulation gear for as long as possible since they are generally not too many inexpensive alternatives.

    So is this a case of the build working but just the editor fails? Did you just try a Windows 10 standalone build also or only a Windows 10 UWP version?

    Since you were talking to the Logitech dev already do you know if they have any plans on releasing an updated Unity version of their Logitech Gaming SDK built with Unity 5.4.1? They built it the Logitech 1.6 plugin with Unity 4.3.1 just wondering if you knew of any plans from Logitech in that department.
     
    Last edited: Oct 9, 2016
  49. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is good to know what combination of tools you are working with.

    What wheels are you supporting in your product?

    As far as I know only Logitech has released a SDK that anyone can work with FFB just by downloading the SDK. I have not seen of anything similar from ThrustMaster.
     
  50. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    I think Logitech's argument was that if they released it on 4.3 it "should" also work with later versions and they wouldn't need to test on multiple versions. There was only 1 dev assigned to the project and once it was "completed" they were assigned to other things. So AFAIK they [had] not plans at that time to release newer versions. Guess we should just keep asking them and see what happens. Maybe they don't think there is enough demand outside the big studios.