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. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    No. Player Action values are made up of the combined input of all bound controller elements, physical or virtual, and the final result as both a virtual button and a virtual axis is provided to you through the Action. You cannot clear Action values. This would cause all kinds of sync problems with underlying elements, especially elements that are permanently on or give continuous values such as dials, toggle buttons, and non-stick axes like throttles.

    Related:
    https://guavaman.com/projects/rewired/docs/FAQ.html#consume-input

    No. This is beyond the scope of an input system and would be implemented as an entirely separate layer on top of the input system. What you are describing is what I refer to as gesture handling. This is a type of input processing which works on the underlying input values coming from the input system. A generalized gesture system that could handle a wide variety of possible use cases with the level of customized timing, input ordering, etc, would be a very large and complex system and would be a separate product if it were to ever exist. This theoretical gesture system could be used with any underling input system as the input values are the same regardless of the input system providing them.
     
    Last edited: Dec 24, 2022
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    No, I don't recommend you do that unless you're prepared to maintain your own copies of the C# scripts, because if you just modify the code, the next time you update Rewired, your changes will be overwritten. (This is how all script-based assets work.) You would have to copy the C# scripts that need to be modified and move it to a folder outside the Rewired folder, change the script and class name, and then replace the Control Mapper component on your GameObject with your new copy.

    https://guavaman.com/projects/rewired/docs/ControlMapper.html#language

    What you're doing here is not what I understood you were trying to do from what you described above -- that being, trying to find out if something has been mapped to either the left or right trigger elements. You're just displaying controller element glyphs for currently assigned Actions. If that's all you're trying to do, there is thorough documentation on this:

    https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action

    Merry Christmas to you as well.
     
  3. itsmikeu

    itsmikeu

    Joined:
    Jan 12, 2022
    Posts:
    10
    Is it reasonable to use Rewired for only keyboard/mouse input alongside Steam Input APIs for gamepad input? My primary concern is that there could be problems with using Rewired in a keyboard/mouse only mode like this. We want our Steam builds to be as "Steam native" as possible, and part of that is fully supporting Steam Input APIs.

    I've read through the documentation, and every post in this thread that mentioned "Steam", and it sounds like there are definitely issues in general with Steam and Rewired. But my specific use case was not brought up, as far as I could find.

    If this would cause problems, my backup plan is to use Unity's new Input System for keyboard/mouse input in Steam builds instead of Rewired. We still plan on fully using Rewired for all non-Steam builds though.

    Thank you for your time!
     
  4. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Thanks! I'll bookmark that one. I need to finish up the last bits of the glyph related tasks first! I'll be back :cool:

    Ah sorry for the confusion. I'm still new to this glyph coding and UI related stuff. Yea, I wanted to know which trigger was mapped to what element(action map id?), so I could update the glyph. Well it all works now, so I can relax a bit now.
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    If you want use the Steam API and consume input through Rewired Player Actions, you would have to use the Custom Controller system pipe the input into Rewired. Otherwise, you would have to consume input in your game through two entirely different APIs -- Rewired and Steam API. You can certainly not use Rewired for controllers / gamepads. Just disable Joystick Auto Assignment and/or don't make any Joystick Maps.

    A game using Rewired is no different than any other application that was not written specifically for the Steam API. There are no additional problems with Rewired than there are with any other application that uses XInput, Raw Input, or Direct Input. All problems people have with Steam are due to Steam and/or not understanding how Steam affects the data returned to the application through the various Windows APIs. I have a large troubleshooting section on Steam that really has nothing to do with Rewired at all and is instead just trying to educate developers on the implications of Steam's input hijacking so they understand what is happening when "something doesn't work." Rewired simply consumes information from the Windows input APIs.
     
  6. itsmikeu

    itsmikeu

    Joined:
    Jan 12, 2022
    Posts:
    10
    Thanks for the help!
     
  7. kevinsyang17

    kevinsyang17

    Joined:
    Apr 3, 2018
    Posts:
    37
    Is there a way to temporarily turn of input detection for a specific action, like bypassing it or ignoring it for the sake of implementing a way to disable player control temporarily?
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    Controller Maps and/or Action Element Maps can be disabled. Actions cannot.

    https://guavaman.com/projects/rewired/docs/HowTos.html#enabling-disabling-controller-maps

    Controllers can be disabled, and they can also be unassigned from Players.

    But what you're wanting to do sounds like it would be much better implemented in your own code and not through the input system. Create a permission management system that determines if a player is allowed to perform a specific game action. Rewired should not be used in place of a permission management system for your game.

    https://guavaman.com/projects/rewired/docs/Actions.html

    Rewired’s Purpose and Responsibilities

    It is common for Rewired's Action system to be used in an unintended manner as an integral part of or in place of a separate game state management system. This is not what Rewired was designed for and not how it is intended to be used.

    • Rewired’s sole purpose is to read user input.
    • All “Actions” in Rewired are actually “Input Actions” and should not be used for any other purpose than to get information about the user’s intent. They should not be confused with or used as game states or actions.
    • The Action “Jump” does not designate “Player is jumping,” but rather “The user wants to jump.”
    • The game should implement permission and state management systems that evaluate user input and then change states. After that point, what happens is outside the responsibility of the input system.
     
    Last edited: Dec 31, 2022
  9. kevinsyang17

    kevinsyang17

    Joined:
    Apr 3, 2018
    Posts:
    37
    The thing is I'm using PlayMaker for player movement. Can I just directly edit the GetButton fsm state block? It's very difficult to implement in PlayMaker as there isn't a way to ignore the later states unlike in code you can just do the return statement like;

    void ProcessMovement(){
    if(!enableControl) return;
    }
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    If you edit the Rewired PlayMaker code, it will be overwritten when you update the PlayMaker Actions (will likely be updated when you update Rewired.). You could make your own PlayMaker actions that include both input and permission checking. That sounds kind of ugly though, and I imagine the same thing must be possible through branching sequences. I don't use PlayMaker so I can't really give you advice on how to use it for managing player state change permissions. I imagine this is a very common problem for Play Maker users as Unity's old input system never had any way to enable/disable input in any way, so it has always been necessary to manage permissions outside the input system.

    What I can tell you is there is no way to disable an Action in Rewired. The way to disable input for specific Actions in Rewired is by disabling Controller Maps (or, less often, Action Element Maps) that map those Actions in the Player. This requires you design your Controller Maps with this in mind. The use case mentioned a number of times in the documentation is mode-specific controls -- On Foot, Vehicle, Airplane, UI, etc. If you need more fine-grained control to disable specific Actions because your game player should not be able to do some kind of action at a specific time, I would argue this is a player state permission issue and shouldn't be handled through the input system. But I don't know what the best way to go about implementing a player state permission system in Play Maker would be.
     
    Last edited: Jan 2, 2023
  11. maikkanerva

    maikkanerva

    Joined:
    Dec 14, 2018
    Posts:
    27
    Hi!

    I've been using Rewired for a few years now, and it's been great, thanks for creating this asset!
    I stumbled upon this weird issue and I just can't wrap my head around it, and was not able to find answers in the FAQ's.

    I have the "Default" map category, and I just created a new Map category specifically for camera movement. I added this map category to the Keyboard layout I'm using and added some basic WASD inputs there. These inputs never worked and don't register at all in the debugger. However, if I move these bindings to the Default category they work fine.

    I've got some other existing WASD bindings in the Default category already, and I'd like to have the camera controls in a separate category for future remapping conflict checking reasons. For some reason, I just can't get the inputs to register if they exist in another map category than the default one.

    I've updated the prefab containing the Input Manager.

    upload_2023-1-2_17-14-31.png
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    Follow this checklist:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#keyboard-problems

    You probably didn't assign this Controller Map to be loaded in the Player on start. Rewired Input Manager -> Players -> Keyboard Maps -> Add Keyboard Map.
     
    maikkanerva likes this.
  13. jouietamse

    jouietamse

    Joined:
    Nov 24, 2018
    Posts:
    4
    Hi I am new to rewired do we you have any tutorials how to navigate UI using Dpad? for unity2019 + rewired setup?
     
  14. unity_D823CE9B3E96D6748393

    unity_D823CE9B3E96D6748393

    Joined:
    Nov 16, 2022
    Posts:
    6
    Hi! is there a way to manually trigger an Up event? or just clear the event queue as a whole?

    If a button is pressed on a controller.. I want to make it so that the player has to release and press the button again(not the actual case but just an example)
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    There is no tutorial because the D-Pad is no different than any other key/button. Map the 4 D-Pad buttons to the positive and negative sides of UIHorizontal and UIVertical.

    https://guavaman.com/projects/rewired/docs/RewiredStandaloneInputModule.html
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    You can't override the input values that come from the hardware:
    https://guavaman.com/projects/rewired/docs/FAQ.html#consume-input
     
  17. SomeHumbleOnion

    SomeHumbleOnion

    Joined:
    Jan 18, 2021
    Posts:
    28
    hey there @guavaman ! I have a question about the Control Mapper

    Is there a way to disable the 'Remove' button for assigning actions to keys/controller buttons? I don't want players to be able to remove action assignments. If this isn't possible, is there a way to prevent the players from leaving certain actions blank (as in not be assigned to any key or controller button)?
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    Every option Control Mapper offers is set through the inspector settings:
    https://guavaman.com/projects/rewired/docs/ControlMapper.html#inspector-options

    Control Mapper does not offer options to impose either of the restrictions you want.
     
  19. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    Hi, I am trying to use the Initializer (Rewired>Create>Initializer) together with ControlMapper. The problem is that ControlMapper needs the reference to RewiredInputManager which does not exist yet because I am using Initializer.
    That ControlMapper doesn't have the reference causes a crash in the build. Any solution for this problem?
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    The reference is primarily used by Control Mapper to populate dropdowns (Actions, Categories, etc.) in the inspector for use in the Unity editor.

    Control Mapper will automatically find the reference to the Rewired Input Manager in the scene.

    Code (csharp):
    1. private void Initialize() {
    2.             if(initialized) return;
    3.             if(!ReInput.isReady) return;
    4. #if UNITY_EDITOR
    5.             // Prevent accidental initialization in edit mode if Reset or other function is called because serialized data could be modified
    6.             if (!Application.isPlaying) return;
    7. #endif
    8.  
    9.             if(_rewiredInputManager == null) {
    10.                 _rewiredInputManager = Object.FindObjectOfType<Rewired.InputManager>();
    11.                 if(_rewiredInputManager == null) {
    12.                     Debug.LogError("Rewired Control Mapper: A Rewired Input Manager was not assigned in the inspector or found in the current scene! Control Mapper will not function.");
    13.                     return;
    14.                 }
    15.             }
    Lack of a reference cannot cause the application to crash. The worst that could happen is a null reference exception, which would halt the execution of code that frame. The exceptions would be logged.

    Rewired Initializer has a script execution order just above the lowest possible value, and therefore will execute Awake long before Control Mapper's Awake function. You should not have a Control Mapper GameObject instantiated and enabled if there is no Rewired Input Manager instantiated first. Rewired Input Manager is a dependency of Control Mapper. ReInput won't even be ready until the Rewired Input Manager has been instantiated and initialized in its Awake function.

    While the Control Mapper reference can be populated by dragging the prefab onto it, that's not necessary, except for the purposes of setting values in the inspector in the Unity editor. Control Mapper will automatically find the Rewired Input Manager scene instance, provided it exists before Initialize is called in Awake, which it should. If this isn't happening, then the instantiation order of your objects is causing the problem.

    If both the Rewired Initializer and Control Mapper are in the scene when it is loaded, Rewired Initializer is guaranteed to initialize first, create the Rewired Input Manager which will then initialize, and finally Control Mapper will initialize. It sounds like you have a Control Mapper existing in your scene, but the Rewired Initializer does not exist yet, and therefore Control Mapper is initializing first. Change this so Control Mapper cannot initialize before the Rewired Input Manager and your problem will go away. Some people choose to include Control Mapper in the prefab hierarchy with the Rewired Input Manager so that it is instantiated at the same time, but that's just one of many ways to deal with the issue. Simply putting the Rewired Initializer and Control Mapper in the same scene will also solve it.
     
  21. Lord_Eniac

    Lord_Eniac

    Joined:
    Jan 28, 2020
    Posts:
    50
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    The link isn't dead. It was blocked by your browser because the SSL certificate expired a few days ago. I fixed the SSL certificate issue.
     
    Lord_Eniac likes this.
  23. moonlessformless

    moonlessformless

    Joined:
    Dec 21, 2017
    Posts:
    9
    Big fan of Rewired, great product. I noticed today while doing memory profiling on my game standalone there are a ton of:
    Rewired.HID.HIDGyroscope.NIavVmDImcxwJwFszvKMLPvjemC[]
    allocations - like at least one a frame - while a DualShock 4 is plugged in.
    I don't use the Gyroscope at all - is it possible to disable this altogether?
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    I need to know the exact version of Unity and Rewired, the build target and platform in use, whether this is in a build or the editor, the chosen scripting backend, and whether or not IL2CPP is in use, and what type of build this is if it is a build (debug, development, release), and any other relevant settings.

    If you don't want the special features of the DS4 to be used, disable Enhanced Device Support in the Rewired Input Manager settings. Vibration, lights, and IMU will be disabled. You can't disable only the IMU.
     
    Last edited: Jan 14, 2023
  25. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    I haven't added new Rewired actions for a while (last I did, it was back on Unity 2019) so I'm not sure when this started, but I'm having an issue where a newly created action can not be inspected in Rewired editor - selecting the action in the list turns the action properties pane completely blank. Please see the attached GIF.

    I'm on 1.1.44.0.U2020. The only thing I found in FAQ is a mention of Data Files field in the same inspector going blank. I checked the reference mentioned in the FAQ and it is properly referencing latest ControllerDataFiles. It might be a similar kind of an issue connected to my input prefab originating from an older Rewired and Unity release. I'd love to know how to troubleshoot this to get to the root cause of this issue!

    I have checked runtime Debug Information pane and that Action is present there, with none of the displayed fields different from what's displayed for actions the Editor successfully opens. Not sure what might make the Editor bail on it.

    If it helps, one additional detail is that the "Dup" (duplicate) button has no effect on that blank action while having an effect on any other preexisting action. The action also can not be deleted at all. I'd love to follow what the inspector is trying to display and troubleshoot it, but unfortunately all involved code is completely obfuscated, so I can't find much.
     

    Attached Files:

    Last edited: Jan 15, 2023
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    I have never seen anything like this. You won't find anything in the documentation about it. All I can imagine is some kind of Unity serialization problem.

    The only things I can think of:

    1. If this is a prefab, "open" the prefab at the top of the object inspector before opening the Rewired Editor using the button in the inspector. Unity's overly-complex prefab workflow has been the source of problems in the past, and I wouldn't be surprised to see more edge cases or new bugs appear.

    2. Export all the data, delete the Rewired Input Manager, and import it again.
     
  27. guitarguruu

    guitarguruu

    Joined:
    Jun 6, 2020
    Posts:
    11
    Hi, is there any way to make it so you can replace a button but not have the option to remove it? Thanks.
     
    Last edited: Jan 17, 2023
  28. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Hi! Unfortunately, neither of these 2 ideas helps. The issue is exactly the same when editing a prefab from prefab mode (that's how I always edit Rewired prefab).

    I created a completely new prefab from scratch, added Input Manager component to it, opened it in prefab mode, imported data I exported from previous prefab from it and... reproduced exact same issue. Adding a new action renders action properties pane missing entirely, deletion button still doesn't work on that new action, etc.

    I'd really appreciate pointers on what can cause this internally. The issue is most likely caused by triggering of one of the early return cases in the inspector code, but I don't know the meaning of the obfuscated fields.There are only 2 possible places responsible for early bailout of inspector code for this pane, both in the same method of InputEditor.cs starting on line 2757:

    Code (csharp):
    1.  
    2. private void CSVFeufRgcrMUArTsWAkyMQCqUaJ(SxMoZTGsqnBtTLNKcmYEPfWIVBGE<int> _param1)
    3. {
    4.   if (_param1.JfrYjFIoFwSuwGsAWhCnVLDLEYvQ < 0)
    5.     return;
    6.  
    7.   InputAction actionById = this.MrUHxsSzAUbibdFCzVvuIKknxriv.GetActionById(_param1.KxgIgwNBhIxNfnDaLZTVRnnOVNBG);
    8.   if (actionById == null)
    9.     return;
    10.  
    11.  ...
    12.  
    Please check what `JfrYjFIoFwSuwGsAWhCnVLDLEYvQ` is and under what circumstances it can be below 0, and please check what `KxgIgwNBhIxNfnDaLZTVRnnOVNBG` is and why `GetActionById` might be returning null with it. This is a pretty unfortunate issue since it entirely blocks me from adding and using new actions, but I hope the cause is something trivial.

    One more avenue that could be explored is content of the plain text prefab changes. When inspecting plain text prefab, the surface modified by a new action is tiny, just 2 fields. The action definition looks identical to an action that displays fine, so it can't be a problem:

    upload_2023-1-17_11-25-29.png

    Therefore, the problem might be with the content of actionCategoryMap field, the only other field modified upon adding a new action.

    upload_2023-1-17_11-26-46.png

    upload_2023-1-17_11-27-7.png

    I'd love to know the meaning of that field and whether it can be related to this issue. Is 5d000000 a correct value for action 93? I checked the exported data from the original prefab without a new action, and discovered something very weird in the JSON version of that field. My last visible action has ID of 91, but in the exported JSON, the final entry in that map field is not 91. There is another entry reading "56". I do not have any actions matching that ID. Perhaps that's what causes the issue? I'll try removing it and importing again.
     

    Attached Files:

    Last edited: Jan 17, 2023
  29. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Update: Solved the bug. It was indeed caused by last integer value of 56 in actionCategoryMap, after last actual action 91. Deleting this value makes the inspector work with new actions.

    upload_2023-1-17_11-45-25.png

    upload_2023-1-17_11-45-53.png

    Not sure if it'd help, but if a value like that can cause an issue, perhaps it's worthwhile to implement a bit of code that clears the actionCategoryMap from nonexistent action IDs whenever an input prefab is saved?
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    Rewired should never leave orphan data in the Rewired Input Manager. There are no code paths of which I am aware that can do that. The only way I have ever seen this happen in the past is through source control merging or other serialized data corruption. Rewired isn't written to check the validity of its indices because there should never a way for data to become corrupt when editing it with the Rewired Editor.

    When an Action is deleted, all references to the id are removed throughout all the data.

    In terms of debugging a problem like this, the best way to proceed (after you verified exporting and reimporting didn't fix the problem) would have been for you to send me the Rewired Input Manager exported data and I could debug it. None of the internals of the Rewired Input Manager are documented and all the code is internal. I'm surprised you were able to find a solution to the problem in the serialized data.

    If it was a source control merge that caused this, I suspect there may be other problems in the data as well. If not, then it's possible you found some kind of unknown edge case that prevented it from deleting the Action Id reference when the Action was deleted.
     
    Last edited: Jan 18, 2023
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
  32. guitarguruu

    guitarguruu

    Joined:
    Jun 6, 2020
    Posts:
    11
    Yes the control mapper.

    Would this ever be possible in the future? Or is there perhaps a way to check that an action has a keybind when closing the menu or another workaround?

    The issue I'm running into is that if the player removes all of the keybinds then they won't be able to do anything upon that Control Mapper closing as I'm opening the Control Mapper via UI Button Press, no mouse controls.
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    That's the reason the documentation advises you decouple your UI controls from your game controls and don't allow rebinding of UI controls:

    https://guavaman.com/projects/rewired/docs/ControlMapper.html#setup

    "NOTE: It is HIGHLY recommended that you create unique menu-only Actions for these UI controls in a separate controller map category from your game Actions. If you use your in-game actions such as "Move Horizonal" or "Jump" for these UI controls, you run the risk of allowing the user to render the UI unusable because they removed an assignment for one of these game Actions which was also controlling the UI."

    It would not just be adding an option to disallow removal of bindings. That itself would lead to many potential problem scenarios. For example, if you allow alternate bindings (2+ columns) and a user added a second binding, they would never be able to remove it. So what you're probably wanting isn't just to disallow removal of bindings. You want a system that allows you to define specific required Actions that must always be bound to some controller element at all times. This would not work if it generally applied to all Actions. It would have to be another user-definable list of Actions. And then it would have to also be aware of different controller types and treat them differently, because it's unlikely you'd require those Actions to always be bound to the Mouse for example. Also, it would need to be smart enough to enforce that both poles of every Axis-type Action be bound to something, because it would be possible for the user to bind only Move Up to a key/button for example and no longer be able to move down. In fact, that Action alone could be problematic, because at the moment the user rebinds Move from the left stick to say, D-Pad Up (only the positive pole of the Action would be bound because D-Pad is a button), they'd lose the ability to move down. Such a system would have to also include detection of this problem scenario and display a UI forcing the user to bind Move Down to some other element before continuing. I don't see adding all this complexity into Control Mapper.

    There are callbacks for you to execute code in certain events like closing Control Mapper. But this wouldn't do any good because they could have already unbound all their controls and may not even be able to close Control Mapper unless you had a protected universal binding to close it. Even if you did, once they've unbound everything, they wouldn't have the ability to go back and make new bindings if they unbound their UI controls.

    If you did execute some code upon closing the UI, it would be very difficult to determine how to add bindings back that would allow them to control the UI since each controller has its own element identifier list. Knowing where to bind the missing elements would be a problem. You would likely have to have code that would try to use the Gamepad Template, but if it didn't implement that, fall back to binding them to generic Axis 0, Axis 1, etc. Another problem you'll run into is conflicts if the user has already bound some other non-UI Action to one of those elements you need to force-rebind your UI-controlling Action to.

    The only other thing I can think of would be to automatically reload all the default bindings if you detect some Action that is critical to controlling the UI has no binding.

    Obviously, if there is a mouse or touch screen available, there's no issue. Without that, the most straightforward workaround is to not allow the user to rebind UI controls.
     
    Last edited: Jan 18, 2023
  34. guitarguruu

    guitarguruu

    Joined:
    Jun 6, 2020
    Posts:
    11
    I really appreciate the detailed reply. I ended up just allowing mouse controls only on the button that will bring up the control mapper to solve this.

    Thanks for the wonderful tool.
     
  35. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    106
    I can't get Cinemachine integration to work. Could it be it's outdated? Unity 2021.3.16
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    Please provide more details about exactly what isn't working and any errors being reported.
     
  37. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    106
    FreeLook input using the integration. Pretty sure everything is set up correctly and I tried many different combos. No errors. It's like the integration isn't there. I've tested the actions and they're working on their own. But FreeLook simply ignores them. The names are fine. I followed your guide carefully.
     
    Last edited: Jan 23, 2023
  38. luuuuyang

    luuuuyang

    Joined:
    Aug 30, 2022
    Posts:
    5
    Hi! I have a question about Digital Axis Instant Reverse property. It says When input is received in the opposite direction of the current flow, reverse the current value to the opposite sign and continue from there.

    So I tried to press A (negative) and then release and press D (positive), the axis value reversed instantly. The two directions were 180 degrees apart so they were opposite. But when I tried to press A and W at the same time and then released and press D and W, the value on the horizontal axis were reversed instantly but not on vertical axis. The two directions were 90 degrees apart so they were perpendicular and not opposite.

    Does this property affect only single keys and ignore key combinations? If so, how can this property be useful in the opposite direction, i.e. 180 degrees, below which should be based on Gravity and Sensitivity.

    Looking forward to your reply. Thank you!
     
    Last edited: Jan 23, 2023
  39. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    106
    So, I've just found out that the Cinemachine bridge is working in build but not in the editor's play mode. Any ideas, @guavaman ?
     
  40. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    106
    After a too-long visit to hell, I finally managed to crawl out lol. Turning off "Enter Play Mode Options" in the Editor settings fixed it.
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    It sounds to me like you're talking about two different Actions, "Horizontal" and "Vertical", which you've mapped to A/D and W/S respectively. The Input Behavior you are modifying is a filter that is applied to each Action's calculation independently. An Action is a virtual control -- a control that can be queried as both a button and an axis, and each Action tracks its own values over time. No Action is aware of any other Action. There is no concept of a 2D Action in Rewired, apart from a couple of convenience functions that allow you to get the float values of two Actions as a Vector2D. Your "Horizontal" and "Vertical" actions are not bound together as a stick control that has a 2D axis.

    Assuming W and D are bound to two separate Actions, Horizontal and Vertical, pressing W should have no effect at all on the value of Vertical. The only time Digital Axis Instant Reverse is ever evaluated is when new input values are received for that same Action, not any other Action.

    Action axis values are 1-dimensional. The Digital Axis Instant Reverse calculation simply reverses the sign of the 1D float value of the Action's axis.
     
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    I'm glad you figured it out because that would have been a nightmare for me to try to attempt to debug.
     
    Ignacii likes this.
  43. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,549
    Related to control mapper and modifier keys - we can assign a default of say "Left Shift" by itself to an action in the editor.. but how to allow the player to do so (within the in-game control mapping)? If there's no existing way I'm just ignorant of, I plan to solve this by showing a message/footnote like "To assign modifier keys alone, hold them until the timer reaches 0." ..in which case, do you have any advice on how to implement that based on your current example?
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    This is already implemented in Control Mapper.

    controlmappermodifier.PNG

    If you are instead referring to Input Mapper instead of Control Mapper, those are part of the Options structure passed to Input Mapper when starting it:

    https://guavaman.com/projects/rewir...Options_allowKeyboardModifierKeyAsPrimary.htm
    https://guavaman.com/projects/rewir...DurationToMapKeyboardModifierKeyAsPrimary.htm
     
    adamgolden likes this.
  45. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    81
    Hey there Guavaman. I spent some time reading over the docs and playing around with Rewired which left a good impression and experience and so I bought it.

    InputMapper resolves 90% of my needs. Is there a function/parameter I may have overlooked to have InputMapper automatically add a map element if it does not already exist? Or a suggestion on how to easily implement this.

    Ex: I have an action already defined. Pressing "Alt+Q" during an InputMapper.Default.Start(context); it finds "Alt+Q" does not exist in the map element for that action and automatically inserts it without any issue.

    Thanks!
     
    Last edited: Jan 28, 2023
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
    I don't understand what you're asking. Because it sounds to me like what you're describing is exactly what Input Mapper does by default.

    If there is no conflict with any other bindings, when you attempt to bind a key while Input Mapper is polling for input, it will create a new binding.
     
  47. One_Learning_Man

    One_Learning_Man

    Joined:
    Sep 30, 2021
    Posts:
    81
    EDIT: Changed my post after testing.

    upload_2023-1-29_1-2-23.png

    Code (CSharp):
    1. InputMapper.Context context = new InputMapper.Context()
    2. {
    3.   actionId = [Cast Fireball Action ID];
    4.   actionElementMapToReplace = null; //Optional
    5.   ...
    6. };
    7. inputMapper.Start(context);
    In setting actionElementMapToReplace to null, I was able to go ahead and press "V" and I now have [A,B,V]. Which is what I was looking for, thanks! I was having a bit of trouble with "actionElementMapToReplace" and adding/rebinding.

    It was like a chicken or an egg confusion for me and was wondering if I needed to have a binding that already exists to point at just to use InputMapper.
     
    Last edited: Jan 29, 2023
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,606
  49. alasky

    alasky

    Joined:
    Nov 23, 2022
    Posts:
    1
    We believe that we may have fixed this. The current Proton Experimental release has some changes that we hope will fix the "Invalid raw input data size:0 bytes" error message. I would be very appreciative if folks could confirm this is fixed, or let me know if they are still seeing the error when they select "Proton Experimental" as the compatibility tool to play their games through :)
     
    guavaman likes this.
  50. reharakhti

    reharakhti

    Joined:
    Apr 8, 2013
    Posts:
    1
    Issue is indeed fixed for me on Proton Experimental, thanks!
     
    guavaman and alasky like this.