Search Unity

Rewired - Advanced Input for Unity

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

  1. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    It sounds like the problem with it being automatic is entirely based on if the user deletes a mapping, and then you don't know if that is a new mapping or the user deleted the mapping. It seems like you could just store an invalid action in player prefs if the player deletes it, such as -1. Then you'd know if it has been deleted, or if it's a new action that should be given the default value.

    I think it boils down to:
    Determine all new actions that were not here when the game previously loaded. That could mean storing a list of known actions, and compare it against all actions defined to determine which are new.
    Get the default value of the action, check if that value is in use for any actions, and if not then assign it as the value for this new action.

    It seems relatively simple, and like it would work for everyone.
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    It isn't entirely based on the user deleting a mapping. That's just one simple example I gave. I also gave two more examples with conflicting mappings that don't involve deletion.

    With a single Controller Map, the issues of deletion and conflicting mappings appear, but it really gets impossible to handle when multiple Controller Maps are used at the same time. There's no way Rewired can know how many are going to be used or enabled at once and which ones those are because that's entirely up to the developer and it can be changed at any time.
     
  3. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I still don't see how that would be a problem. For each controller map, store the actions it knows about. If it finds a new action it's not aware of, attempt to give it the default value if it's not used in a different action.

    Sure, I could wind up doing this myself with a bit of work, but it seems like a feature that should be supported out of the box.
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Saving the Action list with each Controller Map is one form of versioning, though not one I had thought of before. Your suggested method seems reasonable for your specific use case. However, it should be noted that:
    • It would only work for newly created Actions.
    • It could not handle other changes to Action mappings.
    • It could not handle added Action mappings when the Action already existed at the time the XML data was saved.

    When users ask me similar questions to this one, they frequently need to handle other use cases such as the above. In general, it should be understood that saved XML data is not the same thing as the data in the Rewired Input Manager and modifications to the Rewired Input Manager will not be reflected in already saved XML data.

    I will see if the changes can be made to UserDataStore_PlayerPrefs and get back to you.
     
  5. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Good points. For changes to action mappings, perhaps you can also store whether the user has custom assigned the action or not, and if not then do the same kind of logic as if it was a new action. Get default value, check if in use by another action, if not then assign it to the action.

    Granted I realize this probably won't work for 100% of users, but I do feel it would be enough for most users. You could offer this as a setting that people can turn off if they need a more advanced solution.

    What I think would probably be the best solution, and work for probably almost every case, is to change how you store the data. Instead of storing the entire control mapping, just store what has been custom assigned. Then when loading start with the default data, and replace with the custom data. This would allow new key bindings to work, and updating existing bindings that have not been custom assigned.
     
    Last edited: Nov 6, 2016
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    This would not work for the same reasons outlined before. You get into all kinds of impossible situations when you have to handle multiple controller maps. It would be easier to make it work somewhat for single controller map in isolation (I can still see problems there also), but when talking about multiple controller maps in different categories that have to be enabled at the same time, it fails.

    Example:

    Defaults:
    Controller Map 1 (Cat: Gameplay Shared)
    - Fire -> Button A
    Controller Map 2 (Cat: Vehicle)
    - Eject -> Button B

    User remaps Controller Map 2:
    - Eject -> Button C

    Differential data saved:
    Controller Map 2:
    - Eject -> Button C

    Developer then changes the default mappings:
    Controller Map 1:
    - Fire -> Button C

    Load XML Data:
    Controller Map 1:
    - No overrides, use new default Fire -> Button C
    Controller Map 2:
    - Eject -> Button C

    This is just a very simple example, but it's very easy to generate assignment conflicts, especially when multiple Controller Maps may be used simultaneously. There are countless other scenarios where this could happen. What maps exist simultaneously is completely up to the developer and can be changed at any time.

    It was never the purpose of UserDataStore_PlayerPrefs to provide a live editable mirror of the Rewired Input Manager and it shouldn't be thought of as a system that can do that. UserDataStore can be overridden if there are more specific requirements.
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    @emrys90

    Here is a preliminary version of the modified UserDataStore_PlayerPrefs component that will allow you to add new Action mappings to the default Controller Maps and have them appear in loaded XML data. This implements saving of the current Action list at the time the Controller Map is saved as you suggested. Mappings for new Actions that did not exist prior to the Controller Map save will be merged with the Controller Map if no conflicts with the new mapping exist on the loaded Controller Map. Mappings for new Actions will only be added the first time XML data is saved after the new Action is added to the system. Also, the XML data must be saved by the user again with this version in order to record the Action list. New Actions added before the XML data is saved once will not be processed because there's no list to compare against.

    This version of the component uses reflection because one method it needs is internal in 1.0.0.105. I will expose these new methods in 1.0.0.106 so reflection won't have to be used. Note that this preliminary version is not compatible with Windows App Store apps or Webplayer.
     

    Attached Files:

  8. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Okay I'll try it out. Thanks!
     
  9. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    181
    Is it just me or is Rewired making the start-up process of your game REALLY slow? I didn't know what it was at first, but I tracked it down to the Rewired Input Manager.

    When I have a completely empty scene and press play in the Editor, everything's fine. When I add the Rewired Input Manager and hit play it takes like double the time. And it gets even worse when I've written a script and try to compile. Then it takes about 3-4x as long. This is really annoying to be honest.
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    It takes an addition 1-2 seconds to initialize on Windows depending on the hardware. You can disable native input if this is unacceptable.
     
  11. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    181
    'Unacceptable' sounds a bit harsh. It's just annoying when you're tweaking something and are starting and stopping the game multiple times.
    Putting a checkbox in front of 'Disable Native Input' doesn't change anything though. Takes exactly the same time if I do that. Is it enough to put the checkmark there or do I need to do something else? I was thinking of disabling it for phases when I toggle the play mode often and then just put it back on it afterwards.
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Yes, checking Disable Native Input will prevent it from initializing the native input sources entirely. This yields a startup time of ~2.5 seconds when testing with the 8 Players example, while enabling native input yields a startup time of ~3 seconds. Disabling the Rewired Input Manager entirely so that Rewired is not even running yields a startup time of about ~2.5 seconds also. Deleting the Rewired Input Manager object yields a startup time of about 1 second. The additional load time of 1.5 seconds can only be attributed to Unity loading the serialized data from the Rewired controller definitions. Note that these figures are all measured in the editor which has significantly higher overhead than a release build.

    If you are experiencing an increase in startup time significantly longer than this, then I would suggest you check your log file for issues. For example, if the platform uses Unity fallback input and the Unity Input Manager settings have not been properly installed or have been deleted, the log will show a bunch of warnings, and the first time you run it it will be extremely slow because Unity does some kind of extended processing when it throws the exceptions when trying to get input from a non-existent axis name.

    There isn't anything about Rewired that is inherently slow and it does not have to do much at all when starting up when native input is disabled.

    Please provide more details about your situation:
    1. What platform is this?
    2. What are your platform input source settings in the Rewired Input Manager -> Settings page?
    3. You say it makes your startup times double. What does this mean? How big of an increase are you seeing?
    4. How many Players and Actions do you have?
    5. Open the 8 Players example and start it a few times, timing the startup time after the 2nd run, then try disabling native input and time it again.
     
    Last edited: Nov 8, 2016
  13. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    181
    Thank you for the answer.

    I'll try to answer the questions, but I can also tell you how to easily recreate the increased startup time I mean. If I create a new project and add nothing but Rewired there's quite a significant difference between an Input Manager in the scene and no Input Manager. I've measured the time and it's about 1 second longer. The 'Disable Native Input' checkbox yields the exact same result.

    It's not a dealbreaker or anything and I don't want to say Rewired is slow. It's just something that I'm not used to since I only do small games and they always started very quickly without the asset.

    1. Windows and also just tried it on a Mac. And I'm only talking about the Unity Editor here - in release builds I haven't noticed anything.
    2. Just the defaults.
    3. My standard is about 1.25 seconds (timed with stopwatch), with Rewired it's about 2.5. This is the difference between having no Input Manager and just adding the default one in an empty project.
    4. For my tests I didn't add anything, so only System player and no actions.
    5. Doesn't make any difference at all. 2.5 with it enabled and 2.5 without.
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Okay, that's normal and unfortunately there's nothing that can be done to reduce it. As I noted in my previous message, because there is increased load time when the Rewired Input Manager is in the scene but disabled, the additional load time of 1.5 seconds can only be attributed to Unity loading the serialized data from the Rewired controller definitions. The simple fact that the controller data files are linked from an object field in the GameObject's component causes Unity to load those objects regardless of whether the GameObject is enabled or not.

    Unity has to deserialize all the controller definition data every time you press Play. There isn't any way to both keep the support for all these controllers and get the startup time below that without completely overhauling the system to use a database or some other serialization system to store all this data. Doing that would bring all kinds of other challenges and issues because it would have to be cross-platform and work on every single platform Unity supports (21+ now). Rewired was written using the "Unity way" of doing things, using their data storage structures and built-in systems. Unfortunately, this means I don't have control over every single aspect of the process.

    While this increase in startup time may be significant to a blank project, in a real game project, it's likely that the game itself's startup time would be significantly greater than this and therefore the perceived impact would be much smaller vs a blank scene.

    It is worth noting that there is no perceivable difference in load time in a final build. A completely blank scene and a scene with a disabled Rewired Input Manager both start instantaneously (Unity splash screen disabled.) This is only an issue in the Unity editor.
     
    Last edited: Nov 8, 2016
  15. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    181
    I'm glad to hear that this doesn't affect the final build at all. I'll just get used to the increased loading time then since I really want to use Rewired. It just works so much better than the default Input System.

    Thank you for your detailed answers!
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    No problem and thanks!
     
  17. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,462
    The unity asset store is taking a long time for this latest update. It looks like other asset updates are delayed also.
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Indeed. I've been ready to put 1.0.0.106 out for a while, but 1.0.0.105 isn't up yet.
     
  19. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,462
    It looks like Rewired 1.0.0.105 is in the asset store now.
     
    guavaman likes this.
  20. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    181
    Can I somehow suppress that long 'Only one Rewired Input Manager may exist in a scene' warning? I'm getting that constantly since I change scenes a lot but also want to make the game runnable from every scene, so I put one everywhere.
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    No. Are you worried about your users seeing it in the log?

    The Input Manager documentation gives details on how to handle spawning the Rewired Input Manager.
     
  22. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    181
    Not worried, I just like to have no warnings when I compile my game. I changed the spawning according to your documentation, so it's fixed now, thanks!

    Another small question: I set up my UI and it has a button with an OnClick() event that's toggling a panel. Now the problem is that my 'Fire' Button is mapped to the Left Mouse Button. So every time I click that UI button my player shoots and I want to prevent that.
    Is there an easy way to do that?
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    There is nothing built into Rewired for separating UI control from game control (or any other type of control for that matter). This is an implementation issue and isn't really specific to Rewired. Any blocking of input processing will have to be done in your scripts. How you choose to do that depends on your particular situation.

    I'll guess this UI button is always present on the game screen and when the player moves the mouse over this element you want it to ignore game input. If this element is off in a sidebar, it would be as simple as checking that mouse position is within the game area before processing your game input. If the button isn't in a rectangular region like a sidebar and is just floating over the game world, the most obvious way to handle it would be, assuming you're using Unity UI, to raycast from the pointer position and read whether any selectable UI element is present and not process your game input if so.
     
    Last edited: Nov 11, 2016
  24. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    181
    Okay, I'll handle that with a script then. Thanks again for the awesome support! :)
     
    guavaman likes this.
  25. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    Does the Control Mapper Restore Defaults only restore the defaults for the Default map category? I am just starting to mess around with additional map categories/action categories to split my controls into logical groups, but the restore defaults doesn't seem to work for my additional categories.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    No it doesn't. You can look at the source code and see that it calls player.controllers.maps.LoadDefaultMaps, which:

    Loads the maps defined in the Rewired Editor and assigned to this player for the specified controller type. All existing maps will be cleared and replaced with the default maps. The Enabled state of each map will attempt to be preserved, but if you have added or removed maps through scripting, the result may not be as expected and you should set the Enabled states manually.

    The very first thing done in the source of LoadDefaultMaps is to clear all the Controller Maps from the Player. Then it loads everything from the Rewired Input Manager for the Player just as Rewired normally does when the game is first started. Testing with the Control Mapper demo shows that everything works correctly for multiple Map Categories.
     
  27. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    What am I doing wrong then? I see the map categories in the Control Mapper ui, I can manually assign a key binding to actions in it, but if I click the restore defaults button all the bindings are empty instead of being the defaults.
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    The only way I can know is by seeing your Rewired Input Manager and Control Mapper setup. It's very likely a configuration problem in the Control Mapper inspector. Please send me a scene with both the Rewired Input Manager and the Control Mapper you are using in the scene. If they are prefabs, be sure to include those in the Unitypackage.
     
  29. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I think I found the problem. Under the player I didn't add the map categories to the "Assign Default Maps". Missed that setting. Is there a way for a map category in the control mapper to only show actions that belong to that map, instead of every action? Or do I have to do an Action Category for every Map Category as well?
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    There are configuration options in the Control Mapper inspector for determining which Actions to show. These are fully customizable to your needs. See the documentation for information.

    You cannot only show Actions that are currently assigned to a Controller Map in a particular Map Category. Map Category has no relationship to Action Category and does not determine what Actions can be assigned to that Controller Map. Actions are categorized by Action Category only. You can assign any Action in the system to a map in any category. If you want a specific Map Category to only display Action's in a particular Action Category, set it in the inspector. Otherwise, add the Actions individually.
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Please send all support questions via the web support form at http://guavaman.com/rewired#support.

    Support will be completely offline for a few days and response times will be longer than usual thereafter for the time being. Questions will be answered in the order they are received.
     
  32. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    489
    I'm struggling to understand the difference between a Map Category and an Action Category. What I'm trying to accomplish is having like a category for Inventory which shows key bindings related to inventory, and ignores conflict checking for the Game category. It would seem like a Map Category is what I want because it lets you turn off conflict checking for specific maps, but then all the Game actions show in the Inventory Control Mapper even though I did not add any of those actions in the Rewired Editor to that map.

    I can create additional Action Categories to further split it up, but I'm just not understanding why it's like that. Why a Map Category would show actions not assigned to it in the editor.
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Action Category
    • For organizing Actions in logical groupings.
    • An Action may exist within only one Action Category.
    • Primarily used by the Developer to make choosing Actions in the editor easier.
    • Can optionally be used to display an Action Category of Actions to the user in Control Mapper.

    Map Category
    • Categorization for Controller Maps.
    • A Controller Map may exist within only one Map Category.
    • Controller Maps can be loaded into a Player and manipulated by using the Map Category and Layout to retrieve a Controller Map.
    The two are completely different things. One is for organizing Actions, the other is for organizing Controller Maps. Controller Maps contain bindings, they do not contain a list of what Actions are allowed to be bound on that Controller Map.

    If I were to make Control Mapper only show you the Actions that you've mapped for that controller in the Rewired Input Manager, then it wouldn't be possible to create a new Controller Map for a controller which you haven't created a Controller Map for. If a binding was cleared in a Controller Map, then the Action would disappear from the list and you could no longer bind it. Map Categories have nothing to do with organizing Actions. They do not contain Actions nor do they determine what Actions may be bound.

    The Action list displayed in Control Mapper is simply to give the user the ability to create bindings in the Controller Map by Action.

    Action Category:

    Gameplay
    • Move Horizontal
    • Move Vertical
    • Jump
    In Control Mapper, for any Controller Map, you may choose to display either all the Actions in an Action Category or a list of individual Actions of your choice. If you choose to display the Actions in an Action Category for Controller Maps in the Map Category "Default", it will display the following:

    Map Category "Default":
    • Move Horizontal
    • Move Vertical
    • Jump
    And the user will be able to make assignments to those Actions.

    I suggest you read the documentation on Controller Maps to understand the structure of Rewired's map system. Also read about Map Categories. Finally, look at the Control Mapper demo scenes and look how the Map Categories and Action Categories are used.
     
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Please send all support questions via the web support form at http://guavaman.com/rewired#support.

    Support will be completely offline for a few days and response times will be longer than usual thereafter for the time being. Questions will be answered in the order they are received.
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    Rewired 1.0.0.106 is now live on the Unity Asset Store.

    Please read Updating Rewired before updating.

    1.0.0.106:

    Changes:
    - Added new native input library for Windows Store 8.1 to support non-XInput devices.
    - Added Enhanced Device Support for Sony DualShock 4 model CUH-ZCT2U.
    - UserDataStore_PlayerPrefs tries to add new default mappings for newly created Actions when loading XML saved data.

    New Controller Definitions:
    - Microsoft SideWinder Joystick

    API Changes:
    - Added ControllerMap.CreateFromXml method.
    - Added ReInput.MappingHelper.GetControllerMapInstance method.

    Bug Fixes:
    - Control Mapper: UI now resets when certain public properties are changed at runtime.
    - Fixed incorrect Controller Map category name displayed in the Debug Options in the Rewired Input Manager inspector.
    - Fixed bug when unchecking certain options in the Global Options window causing it to copy the Android scripting symbols regardless of the current build target platform.
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    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.
     
  37. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    433
    FYI - This delay in startup time has been slowing development on my projects, the long pause makes it painful to make small changes - I had no idea until now that it was Rewired causing the problem.

    In my experience with editor extensions, there are many things you can do to reduce it, from lazy-loading your associated data ... to having a special "editor only" version that has no controller support (fine for most development work, when you don't need the controllers).

    I suspect this is where I drop Rewired from all future projects. I hit the play button many hundreds of times a day, and any delay breaks my flow of development, jerking me out of what I was doing :(.
     
  38. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    433
    Separate question - I came to the forum to ask how you add a MouseMap that uses Keyboard keys.

    e.g. when ctrl + left click, do something different from shift + left click.

    I can't seem to figure out a way of doing this, it's like the keyboard and mouse are always separated?

    I've:
    - been through the docs (nothing there in Actions, Behaviours, Inputs)
    - clicked all through the GUI
    - created and deleted mouse maps, categories, actions - but couldn't find an option anywhere to combine keyboard and mouse
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    I have explained above exactly where this extra load time comes from -- from Unity loading serialized data. I cannot lazy load this data nor can I modify Unity's serialization system to make it cache this data between runs. There is no way possible that I can modify this short of completely replacing the Unity's ScriptableObject used for storing the serialized data would would cause a huge number problems for all games currently using Rewired.
     
    Acissathar likes this.
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    How To's - Handling Multi-Button Actions

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

    Code (csharp):
    1. // This example shows a simple handling of a 2-button combo where the
    2. // modifier button must be held down and the primary button pressed
    3.  
    4. bool modifier = player.GetButton("ModifierAction"); // get the "held" state of the button
    5. bool primary = player.GetButtonDown("PrimaryAction"); // get the "just pressed" state of the button
    6.  
    7. if(modifier && primary) { // modifier was held or just pressed and primary was just pressed
    8.     // Do something
    9. }
    The constituent Actions can be remapped by the user freely and nothing breaks. You also don't have to worry about the complexities of trying to allow the user to remap actual physical button combos for an Action and worrying about what else may already mapped to the constituent buttons. In addition, this kind of Action combo will work across multiple Controllers and Controller types since Rewired's Player-based input system is largely controller agnostic.
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    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.
     
  42. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    433
    FYI - that's not working when combining mouse with kb.

    if( ...GetButton() ) // works

    if( ...GetAxis() ) // works

    but:
    if( ...GetButton() && ...GetAxis() ) // does not work

    Seems to be a bug there.
     
  43. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,462
    Rewired is currently on sale for those who are interested. [ 30% off the normal price ]
     
    Last edited: Nov 23, 2016
    600 likes this.
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    GetButton will return true when an Action is mapped and the underlying value is non-zero. GetAxis returns the underlying value modified by the InputBehavior. For a mouse, this value is a delta (change in value). It only returns the change in value between frames, and this value can be much less than -1 or much greater than 1, so your code has to be aware of that.
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    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.
     
  46. Suminell

    Suminell

    Joined:
    Feb 24, 2014
    Posts:
    12
    Hi there,

    I'd firstly like to say Rewired is great - it's helped solve a lot of control issues I had using various controllers over various formats so thank you!

    Secondly, I've been poring over your Controller1 example scripts and I'm a fairly lost. I'm attempting to replace existing elements in a keyboard map from a "redefine keys" screen at runtime and I just cannot find the best/easiest way to do it.

    So if the existing keyboard setup is WSAD (up,down.left,right) the the player can replace those keys with QOAP or whatever. How do I replace W with Q in the keyboard map? I have the new key's KeyCode but I don't know where to put it or how. :/

    Sorry if I am missing something very obvious.

    E.
     
  47. guavaman

    guavaman

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

    The correct procedure for key binding is shown in both ControlRemappingDemo1 and in the Control Mapper source code. If you are completely lost by looking through the source code, then I suggest you use Control Mapper instead and do not attempt to write your own control rebinding system.
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,979
    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.
     
  49. Animatronic

    Animatronic

    Joined:
    Aug 31, 2013
    Posts:
    4
    Hey all,

    Anyone know if there is a way to disable/enable Mouse elements separately?

    Disabling the mouse map is a neat solution but I would need to disable only some of the mouse buttons for the duration of hovering over certain UI buttons. I'm working in a networked environment and would like to improve the system by not sending gameplay related mouse data for some elements when clicking UI buttons. I need to keep some of the elements working, though, to have movement and some other actions work while hovering over buttons at times.

    Then again, making a new category just for those mouse elements that can be disabled does not seem like a good idea and would add extra tasks for other systems in my keybind remapping system for example.

    Thanks for you time!
     
    Last edited: Dec 5, 2016
  50. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,262
    Do the new input system from unity make this asset unnecessary?
    Wonder if it will be supported as good as it is now?
     
unityunity