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:
    5,624
    I wouldn't really consider that an issue with Rewired per se since Rewired isn't a UI manager. It comes with the RewiredStandaloneInputModule as a convenience to allow you to control Unity's new UI using Rewired as the input source, but doesn't attempt to go beyond that and provide a full-blown multiplayer UI system built on Unity UI. I would consider that to be the responsibility of a UI package, not the input system.

    As you know by implementing it, Unity's UI does not have any kind of multiplayer Selectable system, so any implementation of one on top of Unity UI will necessarily involve "hacks" to simulate a new Selectable system that allows for multiple cursors/selected objects. You also would have to replace the auto-navigation system since that relies on the currently selected Selectable.

    I like the way you implemented it with virtual cursors. That is probably a much easier method than trying to do multiple active highlighted Selectables.

    Cool video and game! Thanks for sharing! I always love seeing what devs are making using Rewired.

    It reminds me a little bit of Porcupine by Big Green Pillow. This was one of the first games I know of made with Rewired.
     
    Last edited: Jun 27, 2016
  2. Efimera

    Efimera

    Joined:
    Jun 28, 2016
    Posts:
    1
    Hi guavaman!

    Thank you for your awesome development.
    I work for an e-learning company and we are looking for a cheap way to create a VR classroom (using cardboards) for 30 pupils in a school.
    I have 2 questions for you:

    1.-I would like to know if Rewired will work with gamepads like this:

    https://www.amazon.es/Bluetooth-Wir...107_img_2?ie=UTF8&refRID=9K7FWABBEXNES7B3GW35

    or gamepads developed by Andoer VR glasses like this:

    https://www.amazon.es/Head-Mounted-...d=1467033052&sr=1-1&keywords=Andoer+CST-09+VR

    If these gamepads were not supported, could you please recommend me a cheap 6 button gamepad model compatible with rewired?

    2.-Rewired allows the final user to redefine gamepad-buttons/axis-imputs? Is there any documentation to follow to make this possible?

    Thank you so much for your attention!

    Kindly awaiting your response.
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624

    Documentation - Supported Controllers [edit: fixed the link to the docs page]

    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.

    However, if your game only needs to support gamepads, Rewired also has the option on Android to recognized unknown gamepads by treating all unknown controllers as a gamepad with a fixed layout. See the Rewired Editor - Settings page.

    Android: Support Unknown Gamepads:
    Treat all unrecognized controllers as gamepads using the standardized Android gamepad layout. All recognized controllers will be treated normally.

    Warning: While most Android gamepads conform to this layout, there are exceptions. Addtionally, with this option enabled, all unrecognized non-gamepad joystick devices used will be limited to only the set of elements available on a gamepad. If your game needs to support devices other than Android gamepads, disable this option.

    This option only applies to the Android platform.

    Again, see the Supported Controllers list. There are a ton of gamepads that will just work out of the box.

    Of the Android controllers, these are the only ones I find high-quality enough to recommend:
    • Mad Catz C.T.R.L.R
    • Mad Catz Micro C.T.R.L.R
    • SteelSeries Stratus XL
    • Moga Hero Power
    • Moga Pro Power
    • XiaoMi Wireless Game Controller
    • Amazon Fire Game Controller
    • Samsung EI-GP20 Smartphone Game Pad
    None of the above are cheap however, with the XiaoMi probably being the cheapest if you buy it from China on Ebay. Cheap controllers tend to be poor quality in my experience.

    The Red Samurai Wireless Gamepad was a very cheap controller that works reasonably well (I can't say anything about durability), but they don't seem to sell it anymore. It is sold under a ton of different brands like this one, which I'm not 100% sure but I would assume this is compatible since it looks exactly the same. It's sold on Amazon and Ebay under many different models. If you're interested, I would read the reviews first though.

    How To's - Creating a Controller Remapping Screen

    Control Mapper

    Control Mapper is a customizable, responsive control mapping system included with Rewired that you can use in your games. This system provides complete controller remapping including keyboard, mouse, and joystick support, axis calibration, joystick and mouse sensitivity, single or multiple players, controller maps, and much more. Control Mapper can be fully controlled with keyboard, mouse, joystick, and/or touch controls. Control Mapper uses Unity's new GUI system and therefore requires Unity 4.6+.

    Control Mapper has many options which you can customize to fit your game's needs:
    • Optional display of Players for multiplayer games.
    • Optional multiple controllers per-player.
    • Optional Input Behavior customization.
    • Optional Map Category display.
    • Customizable list of Actions to show per category.
    • Optional display of Action category names.
    • Optional Keyboard, Mouse, and Controller support.
    • Choose the number of alternate fields per controller type.
    • Customizable theme settings for changing colors and button styles.
    • Customizable language settings for changing button and window labels and messages.
    • Menu control by your choice of Rewired Player(s).
    • Customizable Actions for opening, closing, and canceling.
     
    Last edited: Jun 29, 2016
  4. MatiasJP

    MatiasJP

    Joined:
    Nov 4, 2013
    Posts:
    16
    Guavaman, there is anyway to get the actionName of the ElementAssignmentConflictInfo?
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Not directly. There may be more than one conflicting Action as well.

    You can do it like this:
    Code (csharp):
    1.  // e is the ElementAssignmentConflictInfo
    2. if(e.isConflict) {
    3.     foreach(var controllerMap in ReInput.players.GetPlayer(e.playerId).controllers.maps.GetMaps(e.controllerType, e.controllerId)) {
    4.         ActionElementMap aem = controllerMap.GetElementMap(e.elementMapId);
    5.         if(aem == null) continue;
    6.  
    7.         InputAction action = ReInput.mapping.GetAction(aem.actionId);
    8.         if(action == null) continue;
    9.  
    10.         Debug.Log(action.descriptiveName);
    11.     }
    12. }
    I am adding actionId and controllerMapId to the struct for the next release.
     
    Last edited: Jun 29, 2016
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Rewired 1.0.0.90 is available for registered users to download on the website. If you would like to register to receive early access to updates, please contact me here. The Unity Asset Store should have the update in 2-10 business days.

    Be sure to read the documentation on Updating Rewired before updating.

    This update brings support for the Pro Flight Trainer PUMA, 4th generation realistic helicopter simulator control system. Fly ultra realistically on your home simulator, flight school trainer, or company procedural trainer. The PUMA can be used in VR helicopter simulators for even more immersive realism.

    ProFlightTrainerPuma.jpg



    This video shows an older model controller by Pro Flight Trainer being used on a VR helicopter simulator.


    Release Notes:

    1.0.0.90:

    API Changes:
    - Added ElementAssignmentConflictInfo.controllerMapId property.
    - Added ElementAssignmentConflictInfo.actionId property.
    - Changed ElementAssignmentConflictInfo contstructor to require controllerMapId and actionId parameters.

    New Controller Definitions:
    - Thrustmaster T500 RS Racing Wheel
    - Pro Flight Trainer PUMA

    Changed Controller Definitions:
    - Split Thrustmaster FFB Wheel into its own definition out of the Thurstmaster T300 RS because multiple Thrustmaster wheels identify themselves as Thrustmaster FFB Wheel when no driver is installed or using the wheel on OSX, Linux, Android, etc.

    Bug Fixes:
    - Reverted Windows Standalone mouse fix from 1.0.0.89 when in the Unity Editor due to editor crashes on some systems. The fix still remains for game builds.

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

    @MatiasJP

    The new additions to ElementAssignmentConflictInfo will allow you to get the actionId of the conflicting assignment. From that, you can get the InputAction from ReInput.mapping.GetAction(actionId) and get the name of the conflicting Action.

    Code (csharp):
    1. // e is the ElementAssignmentConflictInfo
    2. if(e.isConflict) {
    3.         InputAction action = ReInput.mapping.GetAction(e.actionId);
    4.         if(action != null)  Debug.Log(action.descriptiveName);
    5.     }
    6. }
     
    Last edited: Jun 30, 2016
  7. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Wow! The Puma is an amazing Helicopter controller. Only Rewired provides the best flight controller support.

    @Steve Tack finally a helicopter controller for a future VR project.


    @BBRome this would be perfect controller for your helicopter Helisim asset.
     
    guavaman likes this.
  8. longroadhwy

    longroadhwy

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

    Hope the asset store can release this 1.0.0.90 update today.
     
  9. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551

    Rewired 1.0.0.90 is live on the asset store!
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Ahh, so it is! Fast work again!
     
  11. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    It guess that means time for Helicopter Controllers ...long live Puma (4th generation helicopter controller).
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Here's the latest version of the Supported Controllers pic (or rather controllers with extended support since Rewired does support virtually any USB or HID controller by using Control Mapper or another custom controller remapping system.)

    Gamepads galore, light guns, a VR foot controller, and controllers for airplanes, cars, tractors, trains, boats, and now helicopters.

    RewiredSupportedControllers001f.jpg
     
    DMeville likes this.
  13. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Great picture. It is amazing how controllers you support in Rewired.

    Have to find a few more helicopter assets to work with Puma (helicopter controller).
     
  14. manu_nantes

    manu_nantes

    Joined:
    Sep 7, 2012
    Posts:
    3
    Hey everyone,

    I'm new with Rewired, and I would like to remap my Player keyboard control from my project in-game interface exactly like in the "ControlRemapping1" exemple. I tried to find how to by looking into the code but it was pretty hard to find this fonction. The documentation and google didn't helped me either

    Is there something like :
    Player player = ReInput.players.GetPlayer(0)
    player.GetKeybordMap(0).GetAction("Submit").Key = Input.GetKeyDown;

    Thanks a lot by advance
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    How To's - Creating a controller mapping screen

    Rewired now includes Control Mapper, a customizable UI control mapping system built with Unity UI that should fit the needs of many games. Please see Control Mapper for more information.

    Creating a mapping screen from scratch

    Creating a mapping screen can be a difficult task. To get you started, see the example mapping screen in Rewired/Examples/ControlRemapping1. You should be able to adapt this remapping example to fit the needs of your game. The example uses Unity's legacy GUI system.

    Every game's needs are different with regards to user mapping screens. The example project was built for a fairly complex game with a number of players and various game modes and supports saving and loading Controller Maps,Joystick assignment, element remapping, calibration, conflict checking, and more. You should be able to learn what you need to from the example project to customize your own mapping screen.

    IMPORTANT NOTE:
    The ControlRemapping1 demo is 2,000 lines of code. If you are afraid of reading through that much code, stop now and use Control Mapper instead. The vast majority of that code is GUI code to handle all the modal boxes and such. There is a wealth of information in this demo.

    Just as a brief summary, the basic process for changing an element's mapping goes like this:

    1. Get the Player for which you are changing element mappings.
    2. Get the ControllerMap you want to modify from the Player.
      Various functions here can help in finding it. For example:
      player.controllers.maps.GetMap
    3. Poll for input from a Controller to determine the element the user wants to bind.
    4. Optionally check for element assignment conflicts.
    5. Modify an existing ActionElementMap or create a new one with your new assignment. You have your choice of ways to do this, some of which are:
      ControllerMap.ReplaceOrCreateElementMap
      ControllerMap.ReplaceElementMap
      ControllerMap.GetFirstElementMapWithAction (then modify its properties directly)
      ControllerMap.GetElementMapsWithAction
      There are more methods here.
    Note that the above summary does not include the extra steps as shown in the demo which cover conflict checking, how to map axes to buttons and vice versa, dealing with split axes, how to poll for input, saving/loading, and a whole lot more. That's all detailed in the demo, so please read through it to learn how it's done.

    IMPORTANT NOTE 2:Creating your own control remapping system is not for beginners and requires patience and a certain level of programming skill. If you do not have the necessary programming skills, patience, or willingness to roll up your sleeves and dig into the code to learn how to do it, you shouldn't attempt it. If your programming skills are at a level where you need a step-by-step tutorial, this topic is too advanced for you. The purpose of this example is to learn the API. If you are looking for a drop-in control remapping system that doesn't require coding, please see Control Mapper.

    Question: Can you give me a quick and simple example of how to handle control remapping?

    See this answer in the FAQ.

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

    FAQ - Can you give me a quick and simple example of how to handle control remapping?


    Remapping controls in Rewired is very complex because of Rewired's Controller Map and Player systems. It is a very powerful system that allows you to do things that simple static input configuration systems could never do, but it comes at the price of making tasks like this very complex. That is why I have provided both a complete working example that is intended for experienced programmers to read and learn the process from and a complete working UIthat those without advanced programming skills can use directly in their games. I simply cannot make this topic simple and easy, so I choose not to attempt to write what would end up being an extremely long and complex volume on the process. Documentation on the topic can be found here.

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

    Remapping controls in Rewired is very complex because of Rewired's Controller Map and Player systems. It is a very powerful system that allows you to do things simple static input configuration systems could never do, but it comes at the price of making tasks like this very complex. That is why I have provided both a complete working example that is intended for experienced programmers to read and learn the process from and a complete working UI for those that don't have the programming skills can use directly in their games. I simply cannot make this topic simple and easy, so I choose not to attempt to write what would end up being an extremely long and complex tutorial on the subject.

    I have attached two files, a super minimalist joystick remapping example, and a keyboard example that I made for another user a long time ago. I do not endorse using the attached example to learn how to use the Rewired API for controller remapping because it is a gross over-simplification of the process and completely disregards many very important issues with regard to remapping controls, all of which are handled properly and demonstrated in both the ControlRemapping1 demo code and in the Control Mapper code.
     

    Attached Files:

  16. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
  17. guavaman

    guavaman

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

    I can see by this post that you are already familiar with existing options.

    There aren't currently any plans on making an integration for Adventure Creator. Generally, it works better if the asset developer creates the integration for Rewired because he knows the in's and out's of his program. If things in the program need to be changed to make using external input systems possible, he can do that. Working the other way around, you have to hope that the developer created the asset with pluggable input in mind, and if not, come up with some kind of scheme to make it happen which usually involves changing code and hope it doesn't all break when that asset developer changes things or when the asset is updated by the user.

    I suggest you ask the developer of Adventure Creator about the possibility of making an official Rewired integration. I will provide him with a copy of Rewired and help with any issues or questions.
     
  18. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
    Thanks for your response, I'll let Chris Burton now about your sugestion.
    As you see I was trying to integrate both assets and AC already has pluggable input in mind, but I was finding problems in the way and as I saw a menu in Rewired with other integrations (UFPS,...) I thought this would be a very useful one since is a very well known and puchased asset in unity.

    Thanks
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Another approach you could try: Unity Input Override

    The Unity Input Override script reroutes calls to Unity input from most scripts over to Rewired. Simply install it and every script that calls Input.GetButton, Input.GetAxis, etc. will now use Rewired instead of Unity input. This allows you to use Rewired for input without having to change any code in the scripts. This will even work for most assets downloaded from the Unity Asset Store, allowing you to use Rewired as the input source instead of Unity input.

    However, if Adventure Creator uses a DLL instead of a collection scripts, this approach will not work.
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Adventure Creator comes with raw scripts, not a DLL. It has a delegate for using different input systems. @ChrisIceBox wrote a tutorial on it, and this AC forum post has a delegate script specifically for Rewired. We use this script in The Corridor, which is simpler but gets the job done for our needs because we also use Rewired's integration for UFPS.
     
    guavaman likes this.
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Rewired 1.0.0.91 is now available for registered users to download from the website. If you have purchased Rewired and would like to receive early access to updates, please contact me here. The update should be on the Unity Asset Store in 3-10 business days.

    Please be sure to read the documentation on Updating Rewired before updating.

    Full release notes are here.

    1.0.0.91:

    Changes:
    - OSX Native: Added vibration support for XInput-compatible controllers. (360Controller driver required.)
    - OSX Native: Added Enhanced Device Support. Now all the special features of the Sony DualShock 4 work on OSX (wired only).
    - Updated included SDL2 libraries to version 2.0.4. Note: Libraries must be reinstalled from the menu Rewired -> Setup -> Install Libraries -> SDL2.
    - Added option to use the Ouya Everywhere SDK on Razer Forge TV to the Global Options.
    - Made minor optimizations to Action lookups.

    Modified Controller Definitions:
    - Xbox 360 Controller - Added Guide button to OSX Native and OSX Fallback definitions.
    - Xbox One Controller - Added OSX Native definition. (Separated from Xbox 360 Controller definition.)
    - Xbox One Controller - Added OSX Fallback definition.

    Bug Fixes:
    - Fixed exception thrown when SDL2 used as the input source on Windows, OSX, and Linux.
    - OSX SDL2: SDL2 library update to 2.0.4 fixes a bug which could cause each XInput-compatible controller to appear multiple times if attached at runtime along with other controllers.
    - Windows Standalone: Fixed issue where setting vibration every frame on a DualShock 4 caused a drop in frame rate.
    - Windows Standalone: Fixed crash when using Logitech MX Anywhere 2 mouse via Bluetooth.
    - Windows Standalone: DualShock4 D-Pad no longer returns Up for a few frames after runtime start and device connection.
    - Linux Standalone: Joystick.StopVibration now stops vibration when called.
     
  22. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I hope the unity asset store can release it tomorrow.
     
    guavaman likes this.
  23. Saevax

    Saevax

    Joined:
    Nov 3, 2012
    Posts:
    58
    The control mapper has a few oddities I'd like to remove, can you clarify a few things for me?

    I apologize if this has been talked about before and I haven't looked a the code yet but is there a technical reason mouse and keyboard bindings are separate columns in the control mapper? Similarly is there a technical reason axis and individual directions are separate? Can you see any problems I might run into by combining the mouse and keyboard control mapper columns and specifically defining which things I want to be bound to an axis and which things I don't want to have an axis?
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Yes. Control Mapper reflects Rewired's design structure. Each controller type is completely separate from the next including mouse and keyboard. Each Player can contain a list of Controller Maps for each controller type. Mouse and keyboard not are combined, but are separate device types. It is possible to have a Player be able to control the keyboard but not the mouse, and the mouse but not the keyboard. It is also possible for multiple Players to share the keyboard and even possible for multiple Players to share the mouse. Control Mapper was designed to be the most versatile for every type of use case, therefore it doesn't assume any particular control setup.

    These are discussed in the Control Mapper FAQ:

    Q: How can I disable the display of the full-axis field ("Move Vertical", for example). I only want to show "Move Up" and "Move Down"

    You cannot disable the full-axis assignment field. It is integral to the design of Control Mapper and allows the user to assign any joystick axis to an Action. It also provides a means to invert the axis.

    Q: How can I disable the display of the split-axis fields ("Move Up" and "Move Down", for example). I only want to show "Move Vertical"

    You cannot disable the split-axis assignment fields. They are integral to the design of Control Mapper and allow the user to assign buttons and certain types of axes such as analog gamepad triggers to Actions. For example, without these fields users could not assign axis-type actions to D-Pads or hats, which are handled as buttons in Rewired.

    Yes, there could be many problems. As I said, Control Mapper reflects the design structure of Rewired. A couple I can think of off hand:

    1. Control Mapper lets you define how many assignment fields are displayed for each controller type. This limits the number of alternate assignments, when in reality there is no limit in Rewired. By combining the keyboard and mouse columns makes this limit have to be shared. You will have to determine how many assignments are currently made between both mouse and keyboard and decide which to allow. It would be possible for example to make 2 keyboard assignments leaving no space for a mouse assignment, but if you assigned one anyway in the Rewired Input Manager, it would be active but not able to be displayed. You would also have to change the system for changing an assignment because it cannot handle clicking a mouse field and allowing you to change that to a keyboard assignment.

    2. There would be no way to assign/deassign the Mouse from a Player. Currently asks you if you want to assign the mouse to the Player when you first click an assignment field in the Mouse column.

    It's definitely possible to do but it will require changes to a lot of source code and thorough understanding of how the entire Rewired remapping API works.

    I thought I would also mention that this control design is not foreign to gamers. Take these two AAA titles for example:

    Battlefield 4


    Planetside 2
     
  25. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Hi,
    I have deleted action that I don't need now. Than I have deleted related element in keyboard map that was mapped to this action. (in Rewired Editor)

    And now I'm getting this warning in console log:
    Rewired: No action exists for Action Id 23 does not exist. You can create actions in the editor.

    What have I done wrong?

    Thanks
    Peter
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    The only way this could possibly happen is if you are loading XML save data that contains the outdated mapping. You also have to be using an old version of Rewired because it was changed in 1.0.0.89 to silence warnings from loading XML data with maps pointing to non existent Actions.

    XML save data is up to you as the developer to manage. Almost certainly, you are using UserDataStore_PlayerPrefs, probably as part of Control Mapper. See the Control Mapper documentation as well as the User Data Store documentation for information. Save data is not updated or modified when you make changes in the Rewired Input Manager. You must be aware of when you are loading XML data or not if you are to understand what's happening with your mappings. In 1.0.0.88 an editor warning was added every time UserData_PlayerPrefs loads or saves XML data because of the common confusion over this issue.
     
    Last edited: Jul 16, 2016
    camel82106 likes this.
  27. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I know I had seen Control Mapper somewhere else. :):):)
     
  28. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Hey! Rewired is awesome! I have a quick question though, I've been trying to tweak some settings all day but I can't get things working how I'd like, so I thought I'd ask!

    I have a menu that's currently controlled using a controller and ReInput.players.getPlayer(0).GetAxis("Left Stick Y"). I grab the value and if abs(value) > 0.7f, check which sign the value has and move the selected menu item index ++ or --, this all works great.

    I set up a Keyboard Map so that I can control this menu with the keyboard as well, but when I press a key I need to hold it for a short time (~0.5s) before the value of the axis gets to be 1. Tapping the key logs a value of (0.0788) on the first frame it's detected, How can I change it so these axis jump to a large value (1) instantly on button down?

    I've been tweaking the values on the Input Behaviours window, but I can't find a value that makes the axis more responsive. Even with large Sensitivity values of 10000, etc. Here's a screenshot of what it look slike currently. Any idea how I can do this?

    Realized I was setting values on a "Keyboard" Input Behaviour, which was not assigned to any actions. Changing the values on the default Input Behaviour works how I want it to. :p


    Screen Shot 2016-07-17 at 9.29.40 AM.png Screen Shot 2016-07-17 at 9.30.48 AM.png
     
    Last edited: Jul 17, 2016
  29. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Another question, is it possible to have one player using the keyboard, and other players using joysticks?

    How can I make it so if player 1 is using the keyboard, when a joystick is connected it connects to the second player slot?

    Currently I have my "Player 1" setup with a joystick and keyboard map, and Players 2-4 set up with a joystick map, but when Player 1 is using the keyboard and I connect the first controller it joins as Player 1. Is there a way to have the joysticks aware (somehow) that if Player 1 is using the keyboard join the "first" joystick as Player 2?
     
    Last edited: Jul 17, 2016
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Exclude Joy Auto Assign checkbox.

    Or player.controllers.excludeFromControllerAutoAssignment.

    This information can be found in the documentation here:
    Controllers - Joystick Auto-Assignment

    Any custom assignment requirements you may have beyond the options available in the Rewired Input Manager would require you disable joystick auto-assignment and manage controller assignment yourself.
     
    DMeville likes this.
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Another update: 1.0.0.92 is available for registered users. Please contact me here if you'd like to receive early access to updates. The update will be submitted to the Unity Asset Store after 1.0.0.91 is approved to avoid delaying that release which contains important bug fixes.

    1.0.0.92:
    Changes:
    - Added ability to set Joystick vibration with a timeout.

    API Changes:
    - Added Joystick.SetVibration(int motorIndex, float motorLevel, float duration) overload.
    - Added Joystick.SetVibration(int motorIndex, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added Joystick.SetVibration(float leftMotorLevel, float rightMotorSpeed, float leftMotorDuration, float rightMotorDuration) overload.
    - Added IControllerVibrator.SetVibration(int motorIndex, float motorLevel, float duration) overload.
    - Added IControllerVibrator.SetVibration(int motorIndex, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added XboxOneGamepadExtension.SetVibration(int motorIndex, float motorLevel, float duration) overload.
    - Added XboxOneGamepadExtension.SetVibration(int motorIndex, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added XboxOneGamepadExtension.SetVibration(XboxOneGamepadMotorType motor, float motorLevel, float duration) overload.
    - Added XboxOneGamepadExtension.SetVibration(XboxOneGamepadMotorType motor, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added DualShock4ControllerExtension.SetVibration(int motorIndex, float motorLevel, float duration) overload.
    - Added DualShock4ControllerExtension.SetVibration(int motorIndex, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added DualShock4ControllerExtension.SetVibration(DualShock4MotorType motor, float motorLevel, float duration) overload.
    - Added DualShock4ControllerExtension.SetVibration(DualShock4MotorType motor, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added DualShock4ControllerExtension.SetVibration(float leftMotorLevel, float rightMotorLevel, float leftMotorDuration, float rightMotorDuration) overload.
    - Added PS4GamepadExtension.SetVibration(int motorIndex, float motorLevel, float duration) overload.
    - Added PS4GamepadExtension.SetVibration(int motorIndex, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added PS4GamepadExtension.SetVibration(DualShock4MotorType motor, float motorLevel, float duration) overload.
    - Added PS4GamepadExtension.SetVibration(DualShock4MotorType motor, float motorLevel, float duration, bool stopOtherMotors) overload.
    - Added PS4GamepadExtension.SetVibration(float leftMotorLevel, float rightMotorLevel, float leftMotorDuration, float rightMotorDuration) overload.

    Bug Fixes:
    - Fixed transposed left/right trigger motors in XboxOneGamepadExtension.SetVibration and XboxOneGamepadExtension.GetVibration.
     
    Acissathar likes this.
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
  33. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Rewired 1.0.0.93 is now available on the Unity Asset Store! (Overnight approval this time! :eek:)

    Please be sure to read the documentation on Updating Rewired before updating.

    Changes in 1.0.0.92 are listed here.

    Full release notes are here.

    1.0.0.93:

    API Changes:
    - Added Player.GetButtonTimedPress method.
    - Added Player.GetButtonTimedPressDown method.
    - Added Player.GetButtonTimedPressUp method.
    - Added Player.GetNegativeButtonTimedPress method.
    - Added Player.GetNegativeButtonTimedPressDown method.
    - Added Player.GetNegativeButtonTimedPressUp method.
    - Added Player.GetButtonShortPress method.
    - Added Player.GetButtonShortPressDown method.
    - Added Player.GetButtonShortPressUp method.
    - Added Player.GetNegativeButtonShortPress method.
    - Added Player.GetNegativeButtonShortPressDown method.
    - Added Player.GetNegativeButtonShortPressUp method.
    - Added Player.GetButtonLongPress method.
    - Added Player.GetButtonLongPressDown method.
    - Added Player.GetButtonLongPressUp method.
    - Added Player.GetNegativeButtonLongPress method.
    - Added Player.GetNegativeButtonLongPressDown method.
    - Added Player.GetNegativeButtonLongPressUp method.
    - Added Player.AddInputEventDelegate(System.Action<InputActionEventData> callback, UpdateLoopType updateLoop, InputActionEventType eventType, object[] arguments) overload.
    - Added Player.AddInputEventDelegate(System.Action<InputActionEventData> callback, UpdateLoopType updateLoop, InputActionEventType eventType, int actionId, object[] arguments) overload.
    - Added Player.AddInputEventDelegate(System.Action<InputActionEventData> callback, UpdateLoopType updateLoop, InputActionEventType eventType, string actionName, object[] arguments) overload.
    - Added InputActionEventData.GetButtonTimedPress method.
    - Added InputActionEventData.GetButtonTimedPressDown method.
    - Added InputActionEventData.GetButtonTimedPressUp method.
    - Added InputActionEventData.GetNegativeButtonTimedPress method.
    - Added InputActionEventData.GetNegativeButtonTimedPressDown method.
    - Added InputActionEventData.GetNegativeButtonTimedPressUp method.
    - Added InputActionEventData.GetButtonShortPress method.
    - Added InputActionEventData.GetButtonShortPressDown method.
    - Added InputActionEventData.GetButtonShortPressUp method.
    - Added InputActionEventData.GetNegativeButtonShortPress method.
    - Added InputActionEventData.GetNegativeButtonShortPressDown method.
    - Added InputActionEventData.GetNegativeButtonShortPressUp method.
    - Added InputActionEventData.GetButtonLongPress method.
    - Added InputActionEventData.GetButtonLongPressDown method.
    - Added InputActionEventData.GetButtonLongPressUp method.
    - Added InputActionEventData.GetNegativeButtonLongPress method.
    - Added InputActionEventData.GetNegativeButtonLongPressDown method.
    - Added InputActionEventData.GetNegativeButtonLongPressUp method.
    - Added InputActionEventData.GetButtonDoublePressHold(float speed) overload.
    - Added InputActionEventData.GetButtonDoublePressDown(float speed) overload.
    - Added InputActionEventData.GetNegativeButtonDoublePressHold(float speed) overload.
    - Added InputActionEventData.GetNegativeButtonDoublePressDown(float speed) overload.
    - Added InputActionEventType.ButtonPressedForTime.
    - Added InputActionEventType.ButtonJustPressedForTime.
    - Added InputActionEventType.ButtonPressedForTimeJustReleased.
    - Added InputActionEventType.ButtonShortPressed
    - Added InputActionEventType.ButtonJustShortPressed
    - Added InputActionEventType.ButtonShortPressJustReleased
    - Added InputActionEventType.ButtonLongPressed
    - Added InputActionEventType.ButtonJustLongPressed
    - Added InputActionEventType.ButtonLongPressedJustReleased
    - Added InputActionEventType.NegativeButtonPressedForTime.
    - Added InputActionEventType.NegativeButtonJustPressedForTime.
    - Added InputActionEventType.NegativeButtonPressedForTimeJustReleased.
    - Added InputActionEventType.NegativeButtonShortPressed
    - Added InputActionEventType.NegativeButtonJustShortPressed
    - Added InputActionEventType.NegativeButtonShortPressJustReleased
    - Added InputActionEventType.NegativeButtonLongPressed
    - Added InputActionEventType.NegativeButtonJustLongPressed
    - Added InputActionEventType.NegativeButtonLongPressedJustReleased
    - Added InputBehavior.buttonShortPressTime property.
    - Added InputBehavior.buttonShortPressExpiresIn property.
    - Added InputBehavior.buttonLongPressTime property.
    - Added InputBehavior.buttonLongPressExpiresIn property.

    Integration changes:
    - Added PlayMaker Action for Player.GetButtonTimedPress.
    - Added PlayMaker Action for Player.GetButtonTimedPressDown.
    - Added PlayMaker Action for Player.GetButtonTimedPressUp.
    - Added PlayMaker Action for Player.GetNegativeButtonTimedPress.
    - Added PlayMaker Action for Player.GetNegativeButtonTimedPressDown.
    - Added PlayMaker Action for Player.GetNegativeButtonTimedPressUp.
    - Added PlayMaker Action for Player.GetButtonShortPress.
    - Added PlayMaker Action for Player.GetButtonShortPressDown.
    - Added PlayMaker Action for Player.GetButtonShortPressUp.
    - Added PlayMaker Action for Player.GetNegativeButtonShortPress.
    - Added PlayMaker Action for Player.GetNegativeButtonShortPressDown.
    - Added PlayMaker Action for Player.GetNegativeButtonShortPressUp.
    - Added PlayMaker Action for Player.GetButtonLongPress.
    - Added PlayMaker Action for Player.GetButtonLongPressDown.
    - Added PlayMaker Action for Player.GetButtonLongPressUp.
    - Added PlayMaker Action for Player.GetNegativeButtonLongPress.
    - Added PlayMaker Action for Player.GetNegativeButtonLongPressDown.
    - Added PlayMaker Action for Player.GetNegativeButtonLongPressUp.
    - Added duration property to PlayMaker Action RewiredPlayerSetAllControllerVibration.
    - Added PlayMaker Action RewiredPlayerInputBehaviorGetButtonShortPressTime.
    - Added PlayMaker Action RewiredPlayerInputBehaviorGetButtonShortPressExpiresIn
    - Added PlayMaker Action RewiredPlayerInputBehaviorGetButtonLongPressTime.
    - Added PlayMaker Action RewiredPlayerInputBehaviorGetButtonLongPressExpiresIn.
    - Added PlayMaker Action RewiredPlayerInputBehaviorSetButtonShortPressTime.
    - Added PlayMaker Action RewiredPlayerInputBehaviorSetButtonShortPressExpiresIn.
    - Added PlayMaker Action RewiredPlayerInputBehaviorSetButtonLongPressTime.
    - Added PlayMaker Action RewiredPlayerInputBehaviorSetButtonLongPressExpiresIn.
    - Added BehaviorDesigner Task for Player.GetButtonTimedPress.
    - Added BehaviorDesigner Task for Player.GetButtonTimedPressDown.
    - Added BehaviorDesigner Task for Player.GetButtonTimedPressUp.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonTimedPress.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonTimedPressDown.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonTimedPressUp.
    - Added BehaviorDesigner Task for Player.GetButtonShortPress.
    - Added BehaviorDesigner Task for Player.GetButtonShortPressDown.
    - Added BehaviorDesigner Task for Player.GetButtonShortPressUp.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonShortPress.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonShortPressDown.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonShortPressUp.
    - Added BehaviorDesigner Task for Player.GetButtonLongPress.
    - Added BehaviorDesigner Task for Player.GetButtonLongPressDown.
    - Added BehaviorDesigner Task for Player.GetButtonLongPressUp.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonLongPress.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonLongPressDown.
    - Added BehaviorDesigner Task for Player.GetNegativeButtonLongPressUp.
    - Added duration property to BehaviorDesigner Task RewiredPlayerSetAllControllerVibration.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorGetButtonShortPressTime.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorGetButtonShortPressExpiresIn.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorGetButtonLongPressTime.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorGetButtonLongPressExpiresIn.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorSetButtonShortPressTime.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorSetButtonShortPressExpiresIn.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorSetButtonLongPressTime.
    - Added BehaviorDesigner Task RewiredPlayerInputBehaviorSetButtonLongPressExpiresIn.

    Bug Fixes:
    - Fixed bug in InputActionEventData.actionName introduced in 1.0.0.91 that causes an exception to be thrown or returns the incorrect Action name.
    - Fixed bug in InputActionEventData.actionDescriptiveName introduced in 1.0.0.91 that causes an exception to be thrown or returns the incorrect Action descriptive name.
     
  35. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Those new timed presses look useful, cheers. In before @longroadhwy !
     
    guavaman likes this.
  36. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Last edited: Jul 22, 2016
    Karearea likes this.
  37. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Can I use wiimote and nunchuk and other wii accessories?
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    No, Rewired does not support Wiimote, nunchuck, or any other Wii accessory. If on the WiiU platform, these can be supported through the use of Custom Controllers by writing scripts that pipe the data into the Custom Controller from the Unity WiiUInput class. On any other platform, you'd have to write low-level code to interpret the HID reports directly and then pipe that into a Custom Controller.
     
  39. Kade514

    Kade514

    Joined:
    Sep 7, 2014
    Posts:
    12
    Hi, I've recently replaced my input system with the trial version of your rewired system and I have to say that it's making the development of my local multiplayer game infinitely easier thanks to all the stuff you can do with controllers and the like.

    However, recently my editor has begun to crash to the point where it's become impossible to work on my game. I've noticed that other users have had similar problems when using Windows 10 (and Unity's beta versions) and as such have preemptively disabled both the native input and the keyboard input and while it's reduced the frequency of the crashes somewhat they still occur fairly frequently. I'm currently using version 5.3.5f1 of Unity's personal edition and the latest version of Rewired's trial, and just wanted to know if this was a known issue with this version of Unity, and if there's anything I can do to reduce the frequency of the crashes?
     
  40. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    What version of Winodws 10 are you using? (Home, Pro, Enterprise)

    Not using Windows 10 insider program version (slow or fast ring) correct?
     
  41. Kade514

    Kade514

    Joined:
    Sep 7, 2014
    Posts:
    12
    Windows 10 Home. I'm not using the Windows 10 insider project, no.
     
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    If you have disabled native input (using the disable native input option), there is zero chance the crash is coming from Rewired. Disabling keyboard input will also not do anything because keyboard input is taken from UnityEngine.Input and is 100% managed code with no native code involved. The same is true when you disable native input. (Managed code will not crash the editor. The worst it can do is throw an exception.)

    Please verify your Rewired settings by attaching pictures of the Settings page, both the All tab and the Windows tab.

    There are no current reports of Rewired crashing the Windows editor in 1.0.0.93. I do all development on Windows 10 as well and have been doing so for almost a year without issue.
     
    Last edited: Jul 25, 2016
  43. Kade514

    Kade514

    Joined:
    Sep 7, 2014
    Posts:
    12
    Hmmm, it may be due to Unity then. I've given my game another look and the crashes seem to occur after I'm forced to end the Unity process via the task manager and then restart Unity. This hasn't ever happened before so it may still have something to do with Rewired but at this point, it's just a suspicion.

    In any case, here are the screenshots you've asked for.
    Untitled.png
    2.png
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Yeah, you have Disable Native Input checked, so everything is 100% simple managed code using Unity input. I can say with certainty Rewired isn't causing the editor crashes.

    Having to forcing Unity to end the process is normally indicative of an infinite loop. Or, if you have other plugins that access native libraries or memory, that could be the cause.
     
  45. Kade514

    Kade514

    Joined:
    Sep 7, 2014
    Posts:
    12
    Forcing Unity to exit using the process manager is because of infinite loops, yeah. The issue is that when I restart Unity it'll crash after a few seconds in the play mode. It's an issue I haven't encountered before now so I figured that it might have involved this asset. Hopefully, it's just weirdness with this version of Unity that's been solved in 5.4.
     
  46. marco-we

    marco-we

    Joined:
    Nov 19, 2014
    Posts:
    2
    Hi, we just updated to 1.0.0.93.U5 and it stopped working for us. It throws an exception when initializing the plugin.
    Both Unity and native input show the same behaviour:

    Any idea what could be going wrong?

    Update:
    Creating a new Rewired Input Manager and replacing our existing one fixes this, but then all of our settings are gone.
     
    Last edited: Jul 27, 2016
  47. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Did you follow the steps listed here for upgrading?

    http://guavaman.com/projects/rewired/docs/Updating.html

    From the stack trace it looks like you are you are using a patch release of Unity 5.3.5p8? Is that correct?

    What version of Windows are you using? Also are you using Windows Home, Pro, Enterprise, etc.


    Unity 5.3.6 recently came out and it is working fine for me with Rewired 1.0.0.93 on Windows 8.1 PRO (64-bit)
     
  48. marco-we

    marco-we

    Joined:
    Nov 19, 2014
    Posts:
    2
    Yes, 5.3.5p8 here on Windows 10 Pro here.
    The exact same behavior is showing up on 5.4.0f2.

    I'll try the steps that are in the link you posted, we never moved the folder and just installed the newer version from the store.

    Thanks!
     
  49. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    @guavaman (the author/developer of Rewired) uses Windows 10.

    You should also try Unity 5.3.6f1 since that has had the full QA cycle on it.

    Unity made us really hunt to find Unity 5.3.6 based on this thread ...

    http://forum.unity3d.com/threads/5-3-6f1.418383/
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    My analysis of the log indicates that the exception is occurring because you have multiple Actions with identical names and it's trying to add the same key to a dictionary multiple times.

    The Rewired Input Manager enforces Action names to be unique, so in order for this to happen one of the following has to have occurred:
    1. Some kind of error in the Rewired Input Manager failing to enforce unique Action names.
    2. You have modified the data manually in the inspector or some kind of editor script and have added multiple Actions with the same name.

    Please send me a prefab or scene with your Rewired Input Manager alone so I can analyze it.