Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rewired - Advanced Input for Unity

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

  1. haywirephoenix

    haywirephoenix

    Joined:
    May 17, 2017
    Posts:
    101
    Hi there,

    Years later and still using Rewired, thank you!

    I have a question, should be quite straight forward:


    I'm currently utilising the SetMapsEnabled function. (Although I'll probably move to ControllerMapEnabler at some point).
    SetMapsEnabled's default behaviour seems to be to disable all other action categories, which is usually exactly what you need. I would like to keep the Default category enabled when switching, is this possible?

    I am experimenting with having the standard Horizonal,Vertical axis etc stuff in Default so I don't have to add a version of them to every action category. Thanks, looking forward to your response.
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    IMO, it's basically a wasted effort to me to go in and determine exactly why every aspect of this is happening because all it really amounts to is investigating artifacts bubbling up as a result of the aforementioned button queuing during Time.timeScale = 0 issue, which is the root cause. However, I've dug into it and found the exact explanation and why disabling the Controller Maps doesn't help:

    When calculating the digital axis value when the underlying button is True, sensitivity is multiplied by Rewired's own unscaled delta time calculation. This does not use Unity's Time.unscaledTime which doesn't even exist in Unity 4.3, the oldest version of Unity Rewired supports. This unscaled delta time is calculated using a real-time timer which is, again, not affected by setting Time.timeScale to 0. So as far as digital axis simulation is concerned, 20 seconds just passed in the last FixedUpdate frame while it was paused, which results in the digital axis sensitivity applying a gigantic delta time and yielding the full value of 1 instead of slowly ramping it up.

    This section of code may or may not need yet more special case FixedUpdate pause code to handle. In your case, it would not after adding code to block the values from being queued while paused, because if the underlying button were not triggering the Action value to be non-zero on this frame, digital axis simulation wouldn't do anything. However, in the case that a button was just pressed before pause and held during unpause, it would trick digital axis simulation into reporting the full value because of unscaled delta time not taking Time.timeScale = 0 into account in FixedUpdate. This sounds to me like a minor artifact and not worth worrying about. As I think about this, I think this should actually be the intended behavior. Pausing Time.timeScale should not pause input. Yes, it should ignore button down events that occur during that time in FixedUpdate, only because it prevents Rewired from running any code in that loop during that time, but input was never intended to be tied to any kind of scalable or pausable timer.

    Re: Rewired 1.1.10.0

    So many changes have been made since this version (released 1/17/2018), one of which was probably the change to catch button down events. This issue is an artifact from that that makes it apparent that special case code is required to detect and handle Time.timeScale = 0 when FixedUpdate is an enabled input loop in the Rewired settings, something that Rewired never had before.
     
    Last edited: May 8, 2019
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Glad you like it!

    SetMapsEnabled does not disable anything unless you tell it to. It only sets the maps enabled on the Controller Maps you tell it to to the state you tell it to. If you tell it to set all Controller Maps in the "Gameplay" Map Category to True for all Controller types, that's what it will do. It doesn't enable or disable anything it wasn't told to. These methods do nothing but iterate over the Controller Maps, look for matching criteria, and set ControllerMap.enabled to the value you pass.
     
  4. AdamParker

    AdamParker

    Joined:
    Sep 29, 2017
    Posts:
    11
    Thank you for the detailed, in depth responses to my posts, Guavaman. I really appreciate you taking the time and effort to look into it. I tend to agree with your conclusions. Sorry about the "mess".
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    I had already done some work on this but discovered problems as I was testing. Event-based input APIs like Raw Input don't work well with blocking values because buttons that are held get turned off and don't come back on until the next press -- not going to fly with HOTAS devices that have always-on buttons (pun intended). Similarly, some ways of dealing with this lead to buttons getting stuck on. I think I've come up with a reasonable compromise. Update will be available in a few days on the Asset Store.
     
    AdamParker likes this.
  6. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I like your HOTAS pun. :)
     
    guavaman likes this.
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Rewired 1.1.26.0 is live on the Unity Asset Store.

    Please see Updating Rewired before updating:
    http://guavaman.com/projects/rewired/docs/Updating.html

    1.1.26.0:

    Changes:
    - Button down events are no longer enqueued for Fixed Update when Time.timeScale is 0 to work around issues when unpausing Time.timeScale when using Fixed Update for input.
    - Changed installer modal dialogs to work around an extremely rare issue where installation dialog boxes will be spammed with "Cancel" requests repeatedly and infintely by Unity or some other software installed causing the "Get More Information" action to be called repeatedly which opens browser windows until the system crashes. The new behavior when this issue occurs will be that the modal box will be cancelled and skipped and the user will never even see it. This is not a bug in Rewired code that caused this issue and it could not be "fixed" and will never work properly in the rare circumstance that the user's system is behaving this way. Something outside Rewired (Unity or some other software installed) is trying to force close the modal box in the Unity Editor every frame. It's a choice between a system crash or auto-skipping the installation modal. This change is simply a cludge to at least prevent the system from crashing.
    - Improved performance of inspector Debug Information tool after changes made in 1.1.25.0 to remember previously open items.

    API Changes:
    - Added ComponentControls.TouchJoystick.axis2DCalibration property.
    - Made ComponentControls.TouchJoystick.deadZoneType property obsolete.
    - Added ComponentControls.TiltControl.axis2DCalibration property.
    - Made ComponentControls.TiltControl.deadZoneType property obsolete.
    - Added ComponentControls.TouchPad.horizontalAxisCalibration property.
    - Added ComponentControls.TouchPad.verticalAxisCalibration property.
    - Added ComponentControls.TouchPad.axis2DCalibration property.
     
    AdamParker likes this.
  8. AdamParker

    AdamParker

    Joined:
    Sep 29, 2017
    Posts:
    11
    I cannot speak for everyone but the update certainly solved my personal issues. Thank you, Guavaman!
     
    guavaman likes this.
  9. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    I’m trying to figure out the current source of an axis input to determine if it’s coming from a key/button press, or a joystick. GetAxisCoordinateMode let’s you distinguish from a mouse vs joystick, but key presses base axis input is the same absolute mode as a joystick. Using last active controller will tell me if the device was a keyboard, mouse, or joystick, but that doesn’t solve the case of a user mapping an axis direction to a button on a controller (like the d-pad, or even face buttons) as both the button and the joystick show as “joystick”. I can look at the mapping for the action to see what has been set, but if an action has multiple bindings I won’t know which one is currently active.

    The specific case is detecting a Smash Bros “tap” style input: quickly pushing the joystick from neutral to the limit. Think of how the dash in Smash Bros works, pressing the stick left or right means you run in a direction, tapping makes you dash / sprint. This isn’t for a Smash Bros like game, but it’s the easiest way to explain this type of input. A basic implementation for this, assuming a joystick input, being something like this:
    Code (csharp):
    1. float runAxis = player.GetAxisRaw(“run”);
    2. runTap = false;
    3. if (Mathf.Abs(runAxis) < 0.2)
    4.   lastAtRunNeutral = 0f;
    5. else if (lastAtRunNeutral <= maxTapDuration)
    6. {
    7.   if (Mathf.Abs(runAxis) > 0.95)
    8.     runTap = true; // enable sprint
    9.   else
    10.     lastAtRunNeutral += Time.unscaledDeltaTime;
    11. }
    This works great for joysticks, but for a key based axis it always goes from 0.0 to 1.0 in one frame, and I explicitly do not want to trigger a “tap” from key inputs in this way. Instead a double tap or modifier key would be used to enable sprint.

    The only option I can think of for this would be to not use the player.GetAxis() functions at all and instead get the list of mappings for that action, check if any of the mappings are for an actual joystick, and read the axis data from the controller. Is this the only way? If it is, I’m not yet entirely sure how to map an action back to it’s raw controller inputs either.
     
  10. Letitroll

    Letitroll

    Joined:
    May 4, 2014
    Posts:
    6
    Hey Guavaman!

    Thanks for a great plugin! It's working great in my projects.

    However I've updated a project to Unity beta 2019.2 and get these issues:

    Code (CSharp):
    1. Assembly 'Assets/Rewired/Internal/Libraries/Editor/Rewired_Editor.dll' will not be loaded due to errors:
    2. Unable to resolve reference 'UnityEngine.UI'. Is the assembly missing or incompatible with the current platform?
    3. Reference validation can be disabled in the Plugin Inspector.
    4.  
    5. Assembly 'Assets/Rewired/Internal/Libraries/Runtime/Rewired_Core.dll' will not be loaded due to errors:
    6. Unable to resolve reference 'UnityEngine.UI'. Is the assembly missing or incompatible with the current platform?
    7. Reference validation can be disabled in the Plugin Inspector.
    8.  
    9. Assembly 'Assets/Rewired/Internal/Libraries/Runtime/Rewired_Windows.dll' will not be loaded due to errors:
    10. Reference has errors 'Rewired_Core'.
    I just tried to do a complete fresh install of Rewired, but that did not help. Any suggestions?
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    2019.2 is a beta release. Rewired does not support beta versions of Unity. I do not continually make updates to chase whatever breaking API changes they're making or wrap bugs they've introduced in alpha and beta versions of Unity or experimental or preview addons that end up being fixed by the time they release the final version. Rewired only supports current and finalized releases of Unity and their addons.

    It sounds like they've made a breaking API change in 2019.2 which means yet another completely separate branch of Rewired is going to have to be released and maintained unless this can be worked around using reflection which is unlikely since this error is happening in Rewired_Core.dll, not just Rewired_Editor.dll, which is run-time code and cannot be bogged down by reflection.
     
    Last edited: May 11, 2019
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    See the documentation here:
    Getting contributing input sources for an Action
     
    bgolus likes this.
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    They've made a major breaking change that cannot be fixed by reflection hacks. The Unity GUI code has been moved from UnityEngine.UI.dll to Unity.ugui.dll which breaks all assembly references. There is no way to handle this apart from making a completely new, separate branch of Rewired for Unity 2019.2. Assuming this isn't an accidental bug on their part, the new branch will not be released until Unity 2019.2 is no longer in beta and is fully released. This is going to further increase the already labor-intensive and time-consuming update release process.

    2019_2_ugui_dll.png

    Edit: Not an accident. Here your answer:
    https://forum.unity.com/threads/ui.673504
     
    Last edited: May 11, 2019
  14. Letitroll

    Letitroll

    Joined:
    May 4, 2014
    Posts:
    6
    Ok, thanks for responding so quickly!
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    @Letitroll

    The story continues:
    https://forum.unity.com/threads/ui.673504/#post-4534411

    So it sounds like they're going to have to go back to the drawing board on this in some way. All DLLs that reference the UI system are broken and there doesn't seem to be any way to get them to reference the new DLL according to posts. Unity acknowledges this as a mistake. Everything's up in the air at this point.

    This is the reason I don't support betas.
     
  16. mikest

    mikest

    Joined:
    Feb 23, 2015
    Posts:
    29
    Sorry if this has been asked elsewhere, but i was unable to surface it.

    How can you get rewired to fire "repeating" events in the Unity UI? I am specifically wanting to enable holding down the axis to scroll lists. I have the rewired input module in scene, repeat delay set to 1, move one element per axis is unchecked. It seems like this should do it but it doesn't seem to be working for me.
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    With those settings, it would be doing it already. I know of no scenario where this wouldn't work. The code is literally copied and pasted from Unity's StandaloneInputModule.
     
  18. FMFishingCactus

    FMFishingCactus

    Joined:
    Oct 23, 2018
    Posts:
    5
    Hello,

    Currently struggling binding 2 VRInsight Ship Console for the same player. Thats weird because the first is not recognized by Rewired and can be mapped using a "unknow controller" but display "VR i Simulation Controller" in console when connecting/disconnnecting the hardware. The second is recognized by rewired but is displayed as "usb pad" in the console.

    The windows calibration tool for game usb pads behave differently too (values from 0 to 255 for one, 0 to 65k for the other; and differents settings configuration) but are both displayed as "VRi Simulation Controller".

    Currently I have 2 joystick map (both assigned to the player), 1 layout and differents actions are binds on the 3 ship console axis. But only one is working (but the values are changing for both in the rewired debug information tree).
    I tried having a map for the "Unknow Controller" and another for the "VR Ship Console". but it stacked somehow on the same hardware.

    Where am I wrong ? :c
    Or back to the basis, how I am supposed to implements the same controller twice for a single player ?
     
  19. FMFishingCactus

    FMFishingCactus

    Joined:
    Oct 23, 2018
    Posts:
    5
    Forgot to mention Rewired version is 1.1.26.0.U2018 and the settings "Max Joysticks Per Player" is raised to 5.
     
  20. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Got this working now, thanks!
     
  21. mikest

    mikest

    Joined:
    Feb 23, 2015
    Posts:
    29
    It appears that it is only the actions mapped to the UIHorizontal and UIVertical axes used by the left stick that don't repeat. The DPAD buttons are configured to use the same actions and do repeat. Not sure if this is significant but it seems strange so i'm starting to suspect that perhaps I have a misconfiguration on these axes?

    here's some screenshots of my configs. I feel like I must have something wrong in the input behavior.
    https://imgur.com/a/TwS2Irc

    EDIT
    It appears the issue was caused by the Joystick axis sensitivity being set to .5
     
    Last edited: May 14, 2019
  22. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    What version of Unity are you using?
    What operating system are you using? Windows 7/8.1/10 (64-bit or 32-bit)
     
  23. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I just tried VRInsight Ship Console and it works fine using the Rewired Control Mapper single player demo.

    Rewired vesion: 1.1.26.0.U2018
    Unity version: 2018.3.0f2 (64-bit)
    Windows version: Windows 8.1 PRO (64-bit)

    The name "usb pad" makes sense since that is the USB raw info that display for that controller and in the Windows Control Panel. I believe this is the case where Rewired makes a nicer user friendly name for this device.

    But you are trying two VRInsight Ship Console controllers concurrently correct?

    What does the Windows control panel show for the two devices? Does it work correctly? This reminds me of the use case where someone was trying to use dual ThrustMaster T16000M joysticks concurrently. And in the ThrustMaster T16000M use case they needed to use special software (T.A.R.G.E.T) from Thrustmaster to make to handle two devices that were the same.
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    I cannot explain why your two devices are returning different information. Does it matter which order you plug them in? If not, then the hardware is not providing the right identifying information to Rewired and therefore it cannot be recognized. This could be due to some firmware change by the manufacturer.

    I don't understand what you're describing about "stacking on the same hardware." A recognized controller will never load Unknown Controller maps.

    An Unknown Controller map made for the mappings on the 2nd device would work, but is not ideal because that would apply to any other unrecognized controllers. The best way to handle this would be to let the user map the 2nd device themselves using something like Control Mapper.
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Glad you figured it out. The StandaloneInputModule requires a minimum value to activate the axis. The first press probably worked due GetButtonDown returning true for the initial press.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    He said the two devices return different values for some of the elements too. This leads me to the conclusion they may be different revisions or different firmware.

    @FMFishingCactus Use the Rewired/DevTools/JoystickElementIdentifier to see the raw values returned by the devices to note differences.
     
  27. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I looked on the VRInsight and did not see any firmware or software updates available for the ship console. They have updates for their flight simulation products but nothing for the ship console. Also checked wthe Wilco site and they only had a manual for calibration (Ship_Console_Calibration.pdf) for the "throttles and steer" as they call it in the documentation.
    https://www.wilcopub.com/ship-console.html

    Maybe he should try a different usb port and see if gets the same results?
     
  28. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    @guavaman and Rewired users -

    Is there a method in place, or has anyone written one, that will allow me to pass an action, and it will return the first assigned button based on the active controller?

    So, for example, I pass "Jump", and it would return "Spacebar" or "X" - "X" being the glyph for a game controller button if that is the active controller?

    I see some documentation on how to do this... but this also seems like a feature that maybe has already been created somewhere given the control mapper feature and other tools that do this. I don't want to reinvent the wheel if it is already something that exists.

    I'm working on a tutorial system, and I am looking for a way to dynamically tell the user what to do using the active controller mappings. "Press the jump button (X) to get over the wall!" in this case.

    TY!
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    The documentation you mentioned is the authoritative answer on this. There is no built-in, user-customizable, glyph system in Rewired.

    http://guavaman.com/projects/rewired/docs/HowTos.html#get-element-name-for-action
    http://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action
     
  30. Deneb

    Deneb

    Joined:
    Dec 4, 2013
    Posts:
    22
    Hello !

    First, thank you for your amazing asset!
    I’ve been using rewired for two years and I’m more than happy about it.
    So far, it solves everything it can think of.
    Also the documentation is outstanding.

    I’m currently using v.1.1.26.0.U2018

    I have a question about the value range ( -1 / 1 ) received from standard game joysticks
    ( xbox 360 controller )

    I’m looking for to get a value range wider than ( -1 / 1 ) from gamepad controllers joysticks axis.

    Using Input Behaviors, I don’t seem to be able to get input greater/smaller than -1/1 from
    left and right joysticks.
    Now « Mouse XY Axis Sensitivity » works as i expected: I get an input multiplied by the value i set in Input Behaviors,
    but for « Joystick Axis Sensitivity » it is not the case.

    Is there a way to have joystick input value multiplied by rewired?
    like a way to increase the Calibrated Min and Max for a specific axis?
     
  31. Nembroten

    Nembroten

    Joined:
    Nov 28, 2013
    Posts:
    9
    Hello,
    got 2 questions:

    1. I get an error while creating Input Manager Prefab from Menu, so is there any difference with such prefab then if I just add Input Manager to scene and make it a prefab?

    2. When i try to create an input amanger from script:
    obj.AddComponent<Rewired.InputManager>();
    I get a
    Rewired: Error! DataFiles is missing or corrupt! Make sure you have the DataFiles file linked in the inspector.

    and .dataFiles is a read only field so i can't set in on my own.
    so question is: Is there any way I can create Rewired.InputManager from the code?
    I'm big fan of not having empty game objects in edit mode and would rather add all necessary objects from script.


    Here's the error for the prefab create:

    ------- Rewired System Info -------
    Unity version: 2019.1.2f1
    Rewired version: 1.1.26.0.U2019
    Platform: Unknown
    Using Unity input: False

    UnityEngine.Logger:LogError(String, Object)
    Rewired.Logger:LogErrorNow(Object, Boolean)
    Rewired.Logger:LogError(Object, Boolean)
    Rewired.Logger:LogError(Object)
    DyeJMeVobHWZILtDCTYtTqfzOnU:m(,jjjo*n(+*.(j-n,.o*(j,l-k.(Object)
    DyeJMeVobHWZILtDCTYtTqfzOnU:zftLxKhhReJJbPbaLhmVOwkJEOT(Func`1, String, Boolean, String, String, String, String, Boolean)
    DyeJMeVobHWZILtDCTYtTqfzOnU:zftLxKhhReJJbPbaLhmVOwkJEOT(Func`1, String, String, String, String, String, Boolean)
    Rewired.Editor.MenuItems:bIBqeyFyqgtItLhkocxHOboVGCUd(Boolean)
    Rewired.Editor.MenuItems:CreateInputManagerPrefabFromRewiredMenu()
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Thanks, I'm glad Rewired has been useful.

    All Joystick axes are automatically calibrated to a range of -1 to +1. There's no way to change the output range of the calibration, only the input range, or remove it entirely which has other side effects. Axes are designed to output either a value of -1 to +1 for Absolute axes or an undefined range for Relative axes. For Absolute axes (Joystick axes), there's no benefit to changing the range to < or > +- 1. This tells you that the user is inputting a full value on this axis. Changing this to a greater range for the purposes of increasing some kind of speed/sensitivity would be an incorrect use of calibration. You use this data to know the min, max, and zero values of input. Then you apply your own speed, etc., processing after the fact on the result of the Action. This can be as simple as float value = player.GetAxis("Axis") * speed. If you want this only applied to Joystick axes:
    http://guavaman.com/projects/rewired/docs/HowTos.html#get-contributing-input-sources

    You can also differentiate different types of input sources by making multiple Actions and assigning them to different devices.
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Close Unity and restart it and try it again. Try creating it multiple times in a row. Something is going on with Unity 2019. It probably has to do with changes they made to Unity's asset database / serialization system for the new prefab workflow. It is definitely sporadic and not easily reproduced, nor do I believe it is something I can fix because the error is saying a file with a specific pre-determined GUID does not exist in Unity's Asset Database. That file does exist and is distributed with Rewired. Unity is not finding it at some undetermined times for some reason. That would be purely an error in Unity's asset database's handling of files in the project and something I do not have any control over.

    Otherwise, do a clean re-install if the file has been deleted or the GUID of it changed somehow:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#clean-reinstall

    The Rewired Input Manager is not an empty game object. It contains all the data you define in the Rewired Editor -- All Players, Controller Maps, etc. It also must initialize itself before any other scripts so ReInput can be ready for all your scripts in Awake. It is a MonoBehaviour and must be to execute Unity's various callbacks like Update, FixedUpdate, OnApplicationFocusChanged, etc. Obviously, you can instantiate a prefab of it from code. You cannot create a new one from code and make all your Controller Maps, Players, etc. All configuration of the data is done in the editor. The Initializer is a built-in way of instantiating the Rewired Input Manager from a prefab which will still allow Rewired to initialize before any of the other scripts awaken.
     
  34. AlleywayNick

    AlleywayNick

    Joined:
    Jan 26, 2014
    Posts:
    26
    @guavaman,

    I am having an issue where Input is not being sent when the game is paused in the editor and I use the Editor's step button. Was there a change somewhere recently that affected this?

    I've updated to the most recent version and it still isn't working, any help would be greatly appreciated, thanks!
     
    Last edited: May 17, 2019
  35. Nembroten

    Nembroten

    Joined:
    Nov 28, 2013
    Posts:
    9
    Thx for info.

    Regarding the error, I'm getting it when i try to create prefab from
    Window/Rewired/Create/Input Manager (prefab)

    when i just right click folder in Project window and try Rewired/Create/Input Manager all works perfectly fine.

    Both ways generate the same prefab I assume?
     
  36. AlleywayNick

    AlleywayNick

    Joined:
    Jan 26, 2014
    Posts:
    26
    Looks like maybe this change affected my ability to step through using the editor step button and send inputs as no inputs are being processed now if the editor is paused regardless of stepping or not? I really need to be able to get input while stepping, it makes debugging extremely difficult or impossible if this is no longer available via Rewired :/
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Well, it just not going to be possible to both support your needs and the other users for whom I made this change. Input should not be queued while paused. This leads to queuing up input values for as long as its paused and the queue is processed the next time its able to update. Simply blocking new input events while paused will lead to stuck keys on input sources that are event based. I cannot support both stepping and fix the issues the other user was having due to the queued input being processed after unpausing. I don't have any solution for you at the present time. I will probably be forced to revert this change. I am not going to make this an option because it is too obscure and low-level.
     
    Last edited: May 18, 2019
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    There's no difference whatsoever between the two functions except one path asks you for a save file location while the other doesn't. I can find no issues in my testing in 2019.1. Again, this has to be something related to the Unity asset database. It could be specific to your project, may have something to do with your Library folder, etc. It's not something I can fix in code.
     
  39. tspk91

    tspk91

    Joined:
    Nov 19, 2014
    Posts:
    131
    Hi! What would be the best way to create slight variations of a map? In our game we originally just created two map categories for the two variations, each containing all the game controls, and swapped them as needed.

    This has proven time consuming to maintain and prone to mistakes. Also, we just added one variation more and a left handed mode that applies to all three variations. All variations differ only in swapping just one or two joystick axes or buttons.

    Can I load a big base map and then load and unload partial maps over it? If not, is there a way to create map overrides, something of the sort? Or by code?

    Edit: Welp I should have read more the documentation, I think layouts can be used in this way? Additively loading and unloading them.
     
    Last edited: May 18, 2019
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Rewired does not support additive loading of partial Controller Maps. You can load as many Controller Maps in the Player as you want and all enabled Controller Maps will be used. Layouts are nothing more than an id for Controller Map categorization. All input mapping is done through Controller Maps.

    You are free to design your Controller Map scheme as simple or as complex as you want. You can use one giant Controller Map that contains controls for everything in your game, or you can break it up into as many separate Controller Maps as you want, loading only those that you want at any given time. Making different Controller Maps in different Layouts for different modes like Left-Handed, etc. is useful, but it's probably not going to reduce the number of Controller Maps you have to maintain. The most effective way of reducing the number of Controller Maps you have to maintain is by using the Controller Templates as much as possible without making controller-specific overrides.

    If you do break up your input into many Controller Maps, realize that Control Mapper, if you use it, will not all these Controller Maps into one page. Control Mapper can only display one Controller Map at a time on a different page using the Map Category id of the Controller Map to determine.
     
    Last edited: May 19, 2019
    tspk91 likes this.
  41. AlleywayNick

    AlleywayNick

    Joined:
    Jan 26, 2014
    Posts:
    26
    I understand and appreciate both your response and the dilemma :D.

    It seems like supporting the built-in step functionality might be more important than dealing with the user's inputs queuing while pausing with Time.timeScale = 0, because we can come up with our own pausing code relatively easily, but there is no way for us to get inputs during pause->step function of the editor if they are being blocked at that low of a level. Just my two cents, thanks again, love Rewired and all the work you have done to make it amazing!
     
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Thanks!

    The reason this change was implemented wasn't for the Time.timeScale issue. That was entirely separate. It was implemented because button down events were being caught and queued while the Unity editor was paused, causing events to fire based on those keys/buttons that were pressed during pause on the frame after unpausing. For your stepping use case, queuing input events while the editor is paused is absolutely necessary because otherwise the input events you're trying to trigger off of will be ignored when you step. So for stepping to work, input must be queued while play mode is paused. If the last input is left to remain and new inputs are blocked during pause to prevent other key presses totally unrelated to testing from being caught, the result will be stuck on keys on all low-level input sources that are event-based (Raw Input, OSX native, Linux native). Polling-based input sources (XInput, Unity input, etc.) would work properly however because the new state of the button will come in the next frame input updates. So it's one or the other. Queue input events while paused and have the artifact of possibly unintentional input when unpaused or breaking editor play mode stepping.
     
    AlleywayNick likes this.
  43. AlleywayNick

    AlleywayNick

    Joined:
    Jan 26, 2014
    Posts:
    26
    I see, thanks for the response. If you keep Rewired the way it is currently, do you have any suggestions for how one would go about getting input during editor stepping? I suppose I could disable Rewired and use Unity's default input system temporarily for the times when I absolutely need to step for debugging character controller stuff?
     
  44. ahmed_decoy

    ahmed_decoy

    Joined:
    May 19, 2013
    Posts:
    58
    Hey @guavaman

    Having a strange issue with Mac OSX. Input works completey fine on all platforms we support, but for some reason, input it seems is not being read for OSX. In a previous build (sorry not sure how long ago, but definitely worked before) the input worked just fine on OSX. Any reasons you think I'll be getting this behavour now? My game supports both Gamepad and mouse/keyboard. On Start Screen we have a "Press Any Button" to start game. Neither input seems to work. Here's our rewired platform settings:

    upload_2019-5-20_23-18-3.png

    upload_2019-5-20_23-18-33.png
     
  45. HeyItsLollie

    HeyItsLollie

    Joined:
    May 16, 2015
    Posts:
    68
    Hi Guavaman,
    Is there any way to access the raw HID data of a controller, and parse it for input?

    I've been in touch with the developer of a USB PS2 controller adapter (an input sniffer specifically, which reveals itself on PC as a HID gamepad). They recently altered the firmware so that it outputs pressure input for each button on a PS2 controller. Each pressure input had to be marked as "Unspecified", so the pressure inputs aren't readily accessible via the Rewired Editor. Rewired's "Joystick Element Identifier" dev-tool only displays the adapter's axis, buttons, and the hat.

    From what the developer has told me, pressure data IS contained in the raw HID data. I'm hoping it's possible to get into that data, and then figure out a way to parse it.

    I'm only making an input display for personal use, so I'm not worried about making this work across multiple platforms or anything (I'm on Win 10, 64-bit). Any guidance here would be greatly appreciated.
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Use this to determine what is happening:
    http://guavaman.com/projects/rewire...l#debug-information-diagnosing-input-problems
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Nope. Rewired doesn't expose input source / platform specific low-level information for any platform. You won't be able to get this data using Rewired.

    Pressure-sensitive buttons are supported in the button HID usage page. They can also be exposed as axes.
     
    Last edited: May 21, 2019
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    I don't have any solution for you at this time. The only thing I can do is revert the change.
     
  49. HeyItsLollie

    HeyItsLollie

    Joined:
    May 16, 2015
    Posts:
    68
    Damn, that's unfortunate. Do you know of any alternative options for reading raw HID data in Unity? I'm assuming that a custom controller profile wouldn't be enough in this case.

    Do any of the supported PS2 controller adapters (Insten, My-Power, TigerGame) read pressure-sensitive info from PS2 buttons? I've tried a few other (unlisted) adapters already, and while standard analog controls work just fine, all buttons seem to read as digital.
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    You'd have to write your own system to read the HID reports directly from the devices using native Windows functions.

    Custom Controllers are fueled by whatever data you choose to input into them. Custom Controllers aren't going to get this data for you. You can pipe the data into them from your native Windows script that reads the HID information.

    I have only used a few and none of them support pressure-sensitive buttons. Few if any PC games are written to support them. Even Direct Input doesn't support them, so it's understandable why the adapters don't.