Search Unity

Rewired - Advanced Input for Unity

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

  1. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,462
    Rewired sets a very high standard to match when it comes to input handling in my opinion. Rewired supports is well known as the reviews of the product show. The number of controllers supported out of the box is yet to be matched on any platform.

    The biggest issue for me for the new Unity input system is what happens when it gets broken? For example a operating system vendor might just change how a usb driver works for game controllers (Windows 10 has done this a few times already in 2016). How long will I have to wait for a fix from Unity? I look at how well Unity supports it current input system as a indicator of what type of support I can expect for the new input system. As developers it is important to do an evaluation based on a vendors past and current level of support. Because at the end of the day if input is not working our customers do not care what input system we are using in our product. For me a well supported input system is what I need and I have that today with Rewired.
     
  2. blindmen

    blindmen

    Joined:
    Sep 10, 2015
    Posts:
    34
    Hi there,

    I have a problem using rewired with Cloud Build. Any idea?

    10: [Unity] Assets/Rewired/Internal/Scripts/DataStorage/UserDataStore_PlayerPrefs.cs(13,46): error CS0246: The type or namespace name `UserDataStore' could not be found. Are you missing a using directive or an assembly reference?
    11: [Unity] Assets/Rewired/Internal/Scripts/InputManager.cs(9,19): error CS0234: The type or namespace name `Platforms' does not exist in the namespace `Rewired'. Are you missing an assembly reference?
    12: [Unity] Assets/Rewired/Internal/Scripts/InputManager.cs(11,25): error CS0234: The type or namespace name `Interfaces' does not exist in the namespace `Rewired.Utils'. Are you missing an assembly reference?
    13: [Unity] Assets/Rewired/Internal/Scripts/Misc/ExternalTools.cs(7,25): error CS0234: The type or namespace name `Interfaces' does not exist in the namespace `Rewired.Utils'. Are you missing an assembly reference?
     
  3. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,462
    Last edited: Dec 6, 2016
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    No, you can't disable individual controller elements. You would most likely be best off filtering out input based on the value of Actions. If required, you can check whether or not the Action had value contributed by the mouse.
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    I answered this via email. Here's the response:

    1) Cloud build just works according to Unity without any changes to code.
    2) The error you are reporting means one or more DLLs is not set to be used
    on the current build target. See Troubleshooting for information:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#compile-errors-ps4-xbone
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Please send all support questions via the web support form for the time being. Support response times will be longer than usual. Questions will be answered in the order they are received.
     
  7. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    135
    Can't find it in the documentation ..... how to change the update loop type at runtime. I want the users to be able to specify that if they are low spec to run rewired input in the update loop only but if they are high spec to run input in the update loop and fixed update loop also.

    Is this possible, can't find the class to access this setting?
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    No, it's not possible to change the update loop at runtime or from scripting. (Technically it is, but it requires using undocumented methods.)

    I would question why you would want to do this though. If your game code never calls GetButtonDown/Up or similar functions in FixedUpdate, you will get no benefit whatsoever from updating in FixedUpdate. If you do make those calls in FixedUpdate and you don't have Rewired set to run in FixedUpdate, you will miss button up/down events or will get multiple in the same frame depending on the current frame rate. Running Rewired in FixedUpdate is not higher frequency input -- it just makes up/down events work properly when using them in FixedUpdate.
     
  9. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    135
    My physics code runs in a 400 fps loop and it reads axis input in fixed update for use within this loop. As it turns out i can quite happily run in either loop but the difference is that if i run in update loop the same axis value is used multiple times per physics iteration, where as in fixed update the axis values are changing per physics iteration. From the users perspective by running in fixed update they are getting a higher fidelity of control as even though they can only see their input changes at 60 fps because my game is heavily reliant on twitch reflexes and muscle memory the lower latency of running fixed update does make a difference. The problem is not all users have a machine with the capability to run fixed update input loop as the overhead is quite high, so for those i want the option in the menu to run only update loop.....but currently i can't do it.
     
  10. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    can I use your system for to hide USB/Blue Tooth mouse cursor on android phone/TV box?
     
  11. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,462
    Rewired 1.0.0.109 is now available.

    @guavaman thanks for the control mapper change.
     
    Last edited: Dec 29, 2016
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Unfortuantely, the way FixedUpdate works, there is extremely little if any improvement in input latency by updating axis values in FixedUpdate.

    Unity's fixed time step is actually only a simulated fixed time step. Everything is actually run on the main loop on the same thread. The frequency of Update is not modified by the physics update time setting.

    Example, if the current frame rate is < physics time step:
    Physics time step = 400 fps
    Frame rate = 100 fps
    Every time Update is called, FixedUpdate will be called 4x in rapid succession.

    The actual time between FixedUpdate frames is not 1/400th of a second. If you were to use a timer to time the actual time that passed between physics frames, you'd find it to be some very, very tiny duration because these calls to FixedUpdate are made in succession as fast as the CPU can process them. The duration per physics frame would depend on a) the amount of work you are doing in FixedUpdate/physics and b) the speed of the CPU. In the case of input, using FixedUpdate, not being spaced out evenly but rather bunched up into a quick burst of updates periodically, improves latency only during the extremely short time duration that the FixedUpdate calls are being made making it practically useless.

    If the current frame rate is > physics time step:
    Physics time step = 400 fps
    Frame rate = 1600 fps
    FixedUpdate will only be called once every 4 frames.

    In this case, physics will update roughly once every 1/400th of a second, but in this case the Update loop provides lower latency input.

    The above can be verified by using a .NET timer or the Time.realtimeSinceStartup to measure the actual duration of each physics frame.

    If you still really want to enable this, do it like this:

    Code (csharp):
    1. void SetRewiredFixedUpdate(bool enable) {
    2.             InputManager inputManager = FindObjectOfType<Rewired.InputManager>();
    3.             if(inputManager != null) {
    4.                 if(enable) inputManager.userData.ConfigVars.updateLoop |= Rewired.Config.UpdateLoopSetting.FixedUpdate;
    5.                 else inputManager.userData.ConfigVars.updateLoop &= Rewired.Config.UpdateLoopSetting.FixedUpdate;
    6.                 Rewired.ReInput.Reset();
    7.             }
    8.         }
    Be aware that calling ReInput.Reset() will reset everything in Rewired as described in the API reference. This includes invalidating all stored Player, Joystick, or any other Rewired objects. Controller assignments will also be lost.
     
    Last edited: Dec 29, 2016
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    No. Rewired does not use any native libraries on Android which would be required to do what you want to do. In fact, Rewired does not control the hardware cursor on any platform.
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Rewired 1.0.0.109 is available on the Unity Asset Store.

    Please read the Updating Rewired documentation before updating:

    1.0.0.109:

    Changes:
    - Windows Standalone, XInput: XInput library version 1.4 is now prioritized over version 1.3.
    - Windows Standalone, XInput: Removed Guide button detection due to possible crashes in Windows 10 developer preview builds.
    - Added "Don't Destroy On Load" option to Control Mapper inspector.
    Bug Fixes:
    - Fixed incorrect mapping in HOTAS template for Saitek X45 Y axis.

    1.0.0.108:

    Bug Fixes:
    - Fixed exception when setting ReInput.controllers.keyboardEnabled property.
    - Fixed exception in ControllerMap.ReplaceElementMap when used with Custom Controller maps.
    - Fixed exception in ControllerMap.CreateElementMap when used with Custom Controller maps.

    1.0.0.107:

    Changes:
    - Android: Supports new Xbox One S controller firmware.

    Bug Fixes:
    - ControllerMap.ReplaceElementMap now works properly with Custom Controller maps.
    - ControllerMap.CreateElementMap now works properly with Custom Controller maps.
     
  15. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    135
    thanks for the info on fixed update. Based on that we are just going to run within the update loop. It also allowed us to fix another issue we were having to do with fixed time steps, so it was very useful.
     
  16. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
    Hi, I'm trying to add a profile for a Logitech G29 wheel and pedals. I've added a map for the generic Wheel profile and the steering works great however i'm having issues with the pedals. I've tried all combinations i can think of for the axis but all i get is an accelerator that only goes half way and never returns to zero.

    My xbox controller set up works fine so i know it's not an issue with the car physics. I've also reset everything to default in the logitech gaming software.

    Any ideas please?
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Please tell me the current OS (if in the editor) or the Unity build platform (if a build), the Primary Input Source setting in the Rewired Input Manager, whether or not Disable Native Input is checked in the Rewired Input Manager.

    If Windows, try switching your pedals to use independent axes in the Logitech driver software. Also, make sure you have the latest version of the Logitech driver.
     
    Last edited: Jan 4, 2017
  18. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
    Current OS is Windows 10, build platform is Standalone, Unity version 5.5.0p3

    I can't find the primary input source setting but Disable Native Input is unchecked.

    Also i can't find an option in the logitech software to use independent axes.
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Primary input source is in Rewired Input Manager -> Settings -> Windows.

    I also need to know the Rewired version.

    Logitech software has an option to make accelerator and brake share a single axis or use independent axes. Refer to the Logitech software documentation if you can't find it.
     
  20. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
    Primary Input Source is rawInput.
    version is 1.0.0.109.U5

    I will google the axes settings.
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Rewired 1.0.0.109 should be able to work with either axis setup. The only way I can imagine it not working is if the driver version has changed the mappings for the pedals. (Ensure you are using the latest driver.)

    To determine the pedal mappings:
    1. Create a new scene.
    2. Create a new Rewired Input Manager.
    3. Drag the Rewired/DevTools/JoystickElementIdentifier into the scene.
    4. Make sure the JoystickElementIdentifier is at 0, 0, 0 position.
    5. Attach the G29.
    6. Press Play in the editor.
    7. Information will be displayed on the screen showing the Raw Input information for the device. Press each pedal once and release to determine which axes the pedals are on. Note the idle value and the full-press value for each pedal and send me that information.
     
  22. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
    Thanks for the help. It seemed to be an issue with the logitech software being out of date. I updated it and rebooted and it's working fine now.
     
    guavaman likes this.
  23. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,344
    So, G29 (PlayStation version) also works with Windows 10?
     
  24. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    574
    Hi guys,

    I am trialling Rewire to see if it can solve a problem I have with Unity's input system.

    I have 2 Xbox controllers, 1 for each player for my game. If I switch on both controllers before I start the game, and then turn off player 1's controller, I'm left with player 2's controller right? Except when I launch the game the player 2 controller (as indicated by the light on the controller) is now controlling player 1.

    If I switch on player 1's controller at this point that controller becomes player 2's controller.

    Is there a way Rewire can get around this problem? Basically I want the controller that indicates player 2 to always be controlling player 2, and vice versa.

    Thanks!
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    There is no way to force Rewired to match the XInput's controller ID to the Player ID. Rewired works with more than just XInput controllers -- non-XInput controllers can be used simultaneously along side non-XInput controllers which would make locking the XInput ID to the Player ID not practical. Also, the Xbox One controller no longer displays a controller ID light on it when connected.

    If you start the game with the default Joystick Auto-Assignment settings and two XInput devices connected, Player 1 will receive the device with the lowest XInput controller ID and Player 2 will receive the device with the next lowest XInput controller ID. If you then remove Player 1's controller, Player 2 will still retain his correct controller. If you then remove Player 2's controller and then replace one of them back, Player 1 will be given the first controller found regardless of the XInput controller ID.

    Also, understand that XInput on Windows does not always assign controller ID's sequentially. It's entirely possible to plug in a controller and have the light start on ID 2 or 3. The same thing can happen when unplugging and plugging in a controller. You may see the light on one controller alternate between 1 and 2 when unplugging and plugging, etc.

    If you really want to do this, I suggest using an XInput library directly instead of using Rewired. It would only support XInput devices so you wouldn't have to worry about mixing non-XInput devices into the mix and you could use the XInput ID directly for controlling your players.
     
    Last edited: Jan 6, 2017
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    The list of racing wheels with extended support is on the Supported Controllers page and it shows what platforms each works on. I do not know if the PlayStation version is any different than the currently supported G29 as this definition was given to me by an end user. I do not have the wheel itself.
     
  27. kurismakku

    kurismakku

    Joined:
    Sep 18, 2013
    Posts:
    39
    Hi :)

    1) I started testing your asset, and I got most of the things working. I would already bought it, but for some reason Unity Asset store is declining all my credit cards ( I have funds in requested currency on both, and I already bought few assets before ). As it seems, some other developers had this problems as well, so I am trying to get into the contact with the support. If I can buy this asset in some other way outside of Unity Store, please let me know, because we need to release the game in February.

    2) Anyway, this is not actually the main question I wanted to ask. We are making fast paced twin-stick shooter, one good example would be Geometry Wars 2. Player uses left thumbstick for moving, and right thumbstick for aiming and shooting.

    The aiming needs to be super responsive, and super precise. The problem is that I cannot make it work as good as it should be. I am testing it on Xbox 360 gamepad. The problem is that it is really hard to aim in specific direction. It is like the angle cannot be precise enough, it moves too fast or it doesn't change at all if I don't rotate thumb stick enough.

    Do I need to set specific options in Input Behavior settings? Should I set dead zones in some specific way?
     
  28. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,014
    Yeah
     
    sstrong likes this.
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    On question 1, unfortunately I only sell Rewired on the Unity Asset Store. You say you've already bought it, does that mean you already have a license or do you mean you've tried to buy it but the UAS won't let you?

    Question 2:
    If you've left the default settings, Rewired will return the value of the joystick axes only modified by the 2D dead zone and sensitivity. This does not affect the angle of the axis direction returned by the device at all. The range returned by this device is -1 to 1 with corners being about 0.7 -- a circular area. You can see this also by using the Windows Control Panel USB Game Controller tool. Are you processing this value after the fact to find an angle?

    None of the Input Behavior settings affect joystick axes except Joystick Axis Sensitivity. At the default value of 1, the value from the joystick is unmodified. Any other settings besides 1 will act as a multiplier.

    What you are describing about the angle not changing if you don't rotate enough almost sounds like an axial dead zone. Assuming you didn't change the default dead zone setting in the Rewired Input Manager to Axial, Rewired defaults to a Radial dead zone for all recognized sticks. Once outside the dead zone region such as when fully pressed to one side, no dead zone will be applied making it possible to have very smooth rotations. An Axial dead zone would cause there to be regions where the other axis (the one not being fully pressed) sticks to 0 around the cardinal directions as you rotate. Some joysticks have built-in hardware axial dead zones which cannot be removed in software. Also, some joysticks have non-smooth rotations where the axes may stick to +1/-1 for an extended period near the cardinal directions as you rotate around. The Logitech F310 is one such XInput-compatible joystick, so X360 clones are not guaranteed to have smooth rotations. Look at your joystick in the Windows Control Panel USB game controller tool and verify you can smoothly rotate this joystick in circles.
     
    Last edited: Jan 7, 2017
  30. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    193
    @guavaman
    I read most ReWired docs. I am confusing about the user assignable and conflict for Map and Action.
    Would you give me a simple usage example for these concepts?
    In what kind of scenarios, a conflict may happen?
    Conflict.jpg
     
  31. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    46
    Hey guys, trying to set this up and have a question. I've read through a lot of the manual/website but can't seem to figure this out. In my game I have 3 separate joystick maps, and am trying to use an xbox one controller with the dual analog gamepad setup: menu, tank, and helicopter. Each has different controls and I would like to enable/disable them when needed. I have created everything in the rewired input editor, and have all 3 loaded into the players default joystick maps, but only the menu map set as start enabled. Then I have a script that handles vehicle selection. I'm not clear on the getmap commands apparently, because it's not working. Menu is joystick map 0, tank is 1, heli is 2.

    private int playerId = 0;
    private Player player;
    private JoystickMap menuMap;
    private JoystickMap tankMap;
    private JoystickMap heliMap;

    void Awake(){
    player=ReInput.players.GetPlayer(playerId);
    menuMap=player.controllers.maps.GetMap<JoystickMap>(1,0);
    tankMap=player.controllers.maps.GetMap<JoystickMap>(1,1);
    heliMap=player.controllers.maps.GetMap<JoystickMap>(1,2);
    }

    void Tank(){
    menuMap.enabled = false;
    tankMap.enabled = true;
    }

    I have also tried using ControllerMap instead of JoystickMap, and tried different combos of ints in the awake function since I'm not sure what controllerId I need. The error I get is object reference not set to an instance of an object, pointing at the menuMap.enabled = false line. Thanks, sorry for the mess of a post.
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Conflict checking is only for control remapping. You can see it used in both the ControlRemapping1 example and in Control Mapper, both included with Rewired. Use either and try to make an assignment to an element that already has something assigned to it and you will get a dialog box that tells you there's a mapping conflict.
     
    Dan2013 likes this.
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Are you using an IDE with auto-complete and inline help? Most of Rewired's API has XML help. The API reference is also here: http://guavaman.com/projects/rewired/docs/api-reference/html/N_Rewired.htm

    If you look at the API reference for GetMap, you'll see the overload that you are using is not the correct one:
    http://guavaman.com/projects/rewire...ayer_ControllerHelper_MapHelper_GetMap__1.htm

    The overload that takes 2 ints takes two parameters:
    controllerId
    mapId

    You cannot use this overload unless you know the exact unique id of the controller map you want to retrieve. This is not useful in this situation.

    Instead you would use the overload with 3 ints:
    controllerId
    categoryId
    layoutId

    Or you could use the one with one int and 2 strings:
    controllerId
    categoryName
    layoutName

    The help for controllerId shows how to get it:
    Controller id - Get this from the Controller.id property. For Keyboard and Mouse, just use 0.

    You can only get a Joystick Map if you have the id of the joystick for which you want to retrieve that map.

    Code (csharp):
    1. // Get the "Default", "Default" Joystick Map for each joystick assigned to the Player and disable it
    2. foreach(Joystick j in player.controllers.Joysticks) {
    3.     var map = player.controllers.maps.GetMap<JoystickMap>(j.id, "Default", "Default");
    4.     if(map == null) continue;
    5.     map.enabled = false;
    6. }
    But there's a much faster way to do this as shown on the How To's page:
    http://guavaman.com/projects/rewired/docs/HowTos.html#enabling-disabling-controller-maps

    Code (csharp):
    1. // The quick way - one line of code
    2. player.controllers.maps.SetMapsEnabled(state, categoryName);
    One line of code can enable/disable all Controller Maps in a particular category for all controller types.

    Also, you cannot store the Joystick Maps on Awake because each joystick will have its own Joystick Maps loaded at the time the joystick is assigned to the Player. This is explained in Controller Maps.
     
    Last edited: Jan 8, 2017
  34. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    46
    Thanks for the response. The different overload methods were what was confusing me. And whether or not I needed to use JoystickMap as my initial variable. The faster way shown in the How To's I didn't think fit my situation, but I think I need to remap my controls to use that, it would be easier.

    Fantastic asset, thanks for it and the help!
     
  35. kurismakku

    kurismakku

    Joined:
    Sep 18, 2013
    Posts:
    39
    Hi, I have a friend that could buy this asset, and send it for me, would that work if he gives me the license key or the asset must be bought from my account? Thank you.
     
  36. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    193
    I see. Thanks for the explanation.
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    The Input Behavior defaults mimic the Unity defaults to smooth keyboard movement. See the docs:
    http://guavaman.com/projects/rewired/docs/InputBehaviors.html#digital-axis-settings
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#digital-axis-smoothing
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    The Unity Asset Store does not have a gifting system yet as far as I know. The key would be tied to his account and you would have to always log in to his account in order to download Rewired or updates. I'm pretty sure your friend could enter his CC info into your account to buy it for you though.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    I'm guessing you've set your maps up something like this:

    Menu Map: Category = Default, Layout = Menu
    Tank Map: Category = Default, Layout = Tank
    Heli Map: Category = Default, Layout = Heli

    In this case, calling player.controllers.maps.SetMapsEnabled(state, categoryName); wouldn't work well. However, you could just instead do this:

    Code (csharp):
    1. private int playerId = 0;
    2. private Player player;
    3.  
    4. void Awake(){
    5.     player=ReInput.players.GetPlayer(playerId);
    6. }
    7.  
    8. void Tank(){
    9.     // disable all controller maps first
    10.     player.controllers.maps.SetMapsEnabled(false);
    11.  
    12.     // enable only the tank map
    13.     player.controllers.maps.SetMapsEnabled(true, "Default", "Tank"); // do not use deprecated int, int overload here
    14. }
    Or, if it's not too much trouble to change your setup, I recommend using the Map Category instead of the Layout for the different modes as shown in the examples included with Rewired:

    Menu Map: Category = Menu, Layout = Default
    Tank Map: Category = Tank, Layout = Default
    Heli Map: Category = Heli, Layout = Default

    Then you could just use player.controllers.maps.SetMapsEnabled(state, categoryName).
     
    Last edited: Jan 8, 2017
  40. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    46
    That is exactly what I did. I was hoping it was a simple mistake. Thanks again!
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Last edited: Jan 10, 2017
  42. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I frequently have an issue where scrolling with the mouse wheel on UI (such as ScrollRects) does not work. It appears to be random, and restarting the game pretty much always fixes it. Any thoughts as to what would be causing this?
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    Mouse wheel UI scrolling is not controlled by the code in the RewiredStandaloneInputModule. (I'm assuming you're using that but you didn't say.) It's controlled by the code in the underlying PointerInputModule which is Unity's code and has not been replaced by Rewired. As with all UI system problems, try using the StandaloneInputModule first. If that doesn't fix it, it's a Unity UI issue. If it does, there may have been some changes to Unity's systems that will require modifications to the RewiredStandaloneInputModule to mirror those changes. What version of Unity is this?
     
  44. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    This is 5.5.0f3. but I've had this issue for a while. Just never got around to reporting it. Given that I can't reproduce it and it seems random, it would be difficult to try and see if replacing any one thing solves it or not.
     
  45. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,462
    guavaman likes this.
  46. airwick

    airwick

    Joined:
    Jul 15, 2013
    Posts:
    8
    I'm having a hard time finding documentation or a forum thread detailing how to disable map actions at runtime without having to set up a whole new map without the action. Is it possible to disable these temporarily while the game is running? I'm trying to do this for a game tutorial, I need to disable certain inputs temporarily.

    Thank you.
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    The Controller Map itself can be disabled and enabled, but the individual Action Element Maps cannot be disabled. Instead, you delete the Action Element Map. There are many methods in Controller Map to delete an Action Element Map.

    Since it's something you want to toggle on and off, it would be better to create a separate Controller Map for the Action(s) you want to toggle on and off and just enable and disable the Controller Map.

    Is there some specific reason you need to enable/disable individual Actions? Might this better be handled in the game state permission side rather than the input side of things? For example, if at a certain part of your tutorial you want to disable the Jump action alone, I submit it would be better to do this in your input processing code rather than trying to disable the input itself:

    Code (csharp):
    1. if(IsJumpAllowed() && player.GetButtonDown("Jump")) {
    2.     Jump();
    3. }
    The IsJumpAllowed method (or a flag) determines whether your game player is allowed to jump at this time. While the user still would like to jump (he pressed the button), the game permission says he cannot jump. This keeps the input side of things nicely separated and doesn't try to get it intermixed with gameplay state permissions. (The user intent [input] is separated from gameplay action.)
     
  48. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I'm trying to conditionally prevent controllers from being auto assigned. In Awake on a script I am calling rewiredPlayer.controllers.excludeFromControllerAutoAssignment = true;
    However, I am still receiving Rewired.ReInput.ControllerConnectedEvent. What am I doing wrong?
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,978
    ControllerConnectedEvent is fired when a controller is connected to the system, not when it is assigned. You will always receive this event if a controller is connected. What you do with that connection event (assign, unassign, ignore) is up to you.

    Players can be excluded from auto-assignment from the Rewired Input Manager -> Players page also. If you are trying to turn off assignment for some players in the Awake function but joysticks are connected to the system already, on some platforms they will have already been assigned by the time your Awake function is called. If you want to do it from code in Awake instead of in the Rewired Input Manager, you should unassign all joysticks from all players, disable auto-assignment for the players in question, then run an auto-assignment again manually.
     
  50. Little_Gorilla

    Little_Gorilla

    Joined:
    Oct 11, 2013
    Posts:
    71
    Hey Guavaman,

    I have a question about calibrating per-axis sensitivity and deadzones like in the ControlMapperDemo_1PlayerSimple demo scene.

    upload_2017-1-13_11-37-16.png

    I have control remapping working via one of your minimal joystick remapping examples and am wondering if it's possible to set the AxisCalibration based on an action. (ie, set the sensitivity of the action "Horizontal").

    It looks like I need to find which action corresponds to which axis and then modify the AxisCalibration of that axis. but will split-axis actions possibly cause some issues if two actions share an axis?

    For instance if there's racing controls with the following mapping:
    Throttle: Right Stick Y + Axis
    Brake: Right Stick Y- Axis

    Then trying to change the Axis Calibration for Throttle will also change the axis for Brake, is this a limitation of Rewired?

    Just trying to foresee some potential problems!

    Cheers!
     
unityunity