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

    sultanwalid

    Joined:
    May 5, 2011
    Posts:
    29
    Hello @guavaman ,

    Quick question in my project I want to save the mapping data of the first player to all other players.

    Snippet of the code, im using :

    Code (CSharp):
    1.     public void SaveControllerMaps()
    2.     {
    3.         if (ReInput.userDataStore == null) return;
    4.  
    5.         ReInput.userDataStore.Save();
    6.  
    7.         foreach (Player player in ReInput.players.Players)
    8.         {
    9.             if (player.id == 0) continue;
    10.  
    11.             foreach (Joystick joystick in player.controllers.Joysticks)
    12.             {
    13.                 player.controllers.maps.LoadMap(ControllerType.Joystick, joystick.id, "Default", "Default", true);
    14.             }
    15.  
    16.             player.controllers.maps.LoadMap(ControllerType.Keyboard, player.id, "Default", "Default", true);
    17.             player.controllers.maps.LoadMap(ControllerType.Mouse, player.id, "Default", "Default", true);
    18.         }
    19.     }
    Thank you.
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    What is your question?

    Your code is not doing anything but loading the default controller maps for each Player from the defaults you set in the Rewired Input Manager.
     
  3. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    shotoutgames likes this.
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    No, I have no information beyond what's in the documentation.
     
    Last edited: Mar 4, 2021
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    player.controllers.maps.LoadMap does not load data from saved XML/JSON. It only loads maps from the Rewired Input Manager:
    https://guavaman.com/projects/rewir...Player_ControllerHelper_MapHelper_LoadMap.htm

    Saved user XML/JSON (UserDataStore) is entirely separate from data in the Rewired Input Manager. Nearly all functions in the API related to working with Controller Maps work with data from the Rewired Input Manager, not your saved data. (Saving data to UserDataStore is entirely optional and a separate addon to the Rewired core system.)

    I don't have any information about your UserDataStore implementation. I'm going to assume it's the default UserDataStore_PlayerPrefs.

    There is no function you can call on UserDataStore to make it load Player 1's controller maps into Player 2.

    https://guavaman.com/projects/rewir.../html/T_Rewired_Interfaces_IUserDataStore.htm

    The system is designed for saving data per-Player.

    If you want to do that, you're going to have to either modify the UserDataStore implementation to add methods to do what you want to do or manually load the Controller Maps manually into each Player.

    The closest thing I can come up with without modifying UserDataStore is this. This should work, but it may not. It has not been tested.

    Code (csharp):
    1. foreach (Player player in ReInput.players.Players)
    2. {
    3.     if (player.id == 0) continue;
    4.    foreach (Joystick joystick in player.controllers.Joysticks)
    5.    {
    6.       player.controllers.maps.AddMap(joystick, ReInput.mapping.GetControllerMapInstanceSavedOrDefault(0, joystick, "Default", "Default"));
    7.    }
    8.  
    9.    player.controllers.maps.AddMap(ReInput.controllers.Keyboard, ReInput.mapping.GetControllerMapInstanceSavedOrDefault(0, ReInput.controllers.Keyboard, "Default", "Default"));
    10.    player.controllers.maps.AddMap(ReInput.controllers.Mouse, ReInput.mapping.GetControllerMapInstanceSavedOrDefault(0, ReInput.controllers.Mouse, "Default", "Default"));
    11. }
    This assumes you only use one Controller Map per device, which is unlikely.

    This is not how I would handle this though. I would make my own implementation of UserDataStore and use the same methods it uses to load the data into the player from XML into the Player you want to load it into.
     
    sultanwalid likes this.
  6. sultanwalid

    sultanwalid

    Joined:
    May 5, 2011
    Posts:
    29
    @guavaman

    Hey, yep that's clear!

    Thanks for the help!
     
  7. Bistou1

    Bistou1

    Joined:
    Oct 9, 2019
    Posts:
    3
    Hi,
    I bought the asset about a week ago and been trying to get my stuff to work read lots of the documentation but some things stay blurry in my head =/

    i made a list of actions, map categories and controller maps, then i made map enabler rules but not real sure the correct way to call it in script.

    My map categories are default, gameplay and inGameUI
    i have a map enabler rule saying when its closedUI enable default and gameplay and disable inGameUI

    i enabled the map enabler in the player and added the rule sets with ClosedUI as start enabled but when i try only default is enabled and nothing of gameplay works

    what is the right way to call my rules in script ? and should i maybe use the map categories and enable them directly when needed ? how to call that ?

    sorry for my newb questions =/ i understand better with the help of people
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    Show me your Rule Sets, Rules, and the Rule Set assignment to the Player. I can't tell you why it's not working without seeing what you set up.

    Are you viewing what is enabled/disabled using Debug Information?

    https://guavaman.com/projects/rewired/docs/MapEnabler.html#enabling-disabling-rule-sets

    You do not have to call anything in scripting for the initial state change on start if the Rule Sets are assigned to the Player and enabled.

    No. Do not mix using Map Enabler and manually enabling and disabling controller maps if those controller maps are managed by Map Enabler.
     
  9. Bistou1

    Bistou1

    Joined:
    Oct 9, 2019
    Posts:
    3
    ^^' i forgot to add the new maps to the controller in the player after separating them into categories so that works now thanks :D

    i have the default and gameplay active on start as expected now to call them when i open a ui


    player.controllers.maps.mapEnabler.ruleSets.Find(item => item.tag == "UI").enabled = true;
    i'm not familiar with Find but since its a list and i only have two i could call it like that:

    player.controllers.maps.mapEnabler.ruleSets[MapEnablerRuleSet.ClosedUI]
    and store it in a var to be called when needed ?
    do i have to disable all others when i enable one ? like does enabling one rule set disable the others or you can have many rule set enabled at the same time so i should manage that accordingly ?

    And i do have to call Apply each time i change the enabled state right ?

    thank you so much for your help :)
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    No, there is no constant you can use that will select the closed UI rule set. Rule sets are lists and can be rearranged like any other list at runtime or even be created at runtime. Constants don't apply here.

    Documentation on List.Find:
    https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.find?view=net-5.0

    Again, rule sets are a list and you can work with them however you like using any method that you can use on any list or collection in C#. All it's doing is finding the item in the list that has a tag that matches a string. You could just as easily iterate the list and find it manually.

    You are in complete charge of what Rule Sets are enabled and disabled. Nothing is automatic. No Rule Sets will be disabled because you enable a different Rule Set.

    This is explained in the documentation. See the chart and information at the top:

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



    1. Each Player has its own Map Enabler that can be used to manage the Controller Maps for that Player.
    2. The Map Enabler contains a list of Rule Sets.
    3. Each Rule Set contains a list of Rules which determine what Controller Maps are to be enabled or disabled.
    4. When Apply is called on the Map Enabler (manually or when certain things happen such as when assigning a Controller to a Player or loading Controller Maps), all Rules in all enabled Rule Sets are processed one at a time in order. Controller Maps for the matching Controllers are enabled or disabled to comply with each Rule.
    Apply exists because you are modifying a List. You modify the rules by enabling or disabling something in that list, but the system doesn't know anything changed just because you modified something in the list. If you change something and you want those changes to take effect and be applied to your Controller Maps, you have to call Apply.
     
  11. pez

    pez

    Joined:
    Jul 6, 2013
    Posts:
    52
    Hi,

    Don't really think this is a rewired problem, more of a hardware thing.. but are there any solutions out there for unifying the haptic motor levels between different joypads? Specifically between Xbox & Playstation.

    Seems like PS is way more intense than Xbox at low Motor Levels. I've tried creating something custom to change the motor level based on the Joypad type, but even scaling at 1 for Xbox & 0.01 for PS, PS is still pushing a much stronger haptic feedback.

    Searching google didn't really return anything to help me with this, so wondering how other devs handle it!

    Thanks,
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    Rewired does not attempt to equalize vibration motors across gamepads. What constitutes equal would be totally subjective without some kind of equipment to measure the physical response. And then you'd have the problem of different controllers with motors of different age responding differently...

    If the minimum vibration on one motor is too strong, the only thing you can do is use the other motor, assuming you were using the stronger motor to begin with.
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
  14. LithiumFox

    LithiumFox

    Joined:
    May 6, 2020
    Posts:
    5
    I believe it was asked previously, but I have bought Rewired already (a few months ago), but was curious if the module would allow for directinput tracking (eg: T300RS wheel) while in the background?

    The goal I have is to have something track my wheel while running as an overlay for my streams, so I don't want to have it in focus. (Eventually I am working on like a software available for public use but right now i'm trying to get a rudimentary system in place.)

    If it's not available, that's fine. Just means I got to work on something myself and spend more time on that but... @.@ if its already available why not save some time.
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    It depends on the platform, the chosen input source, and the device type. Disable Ignore Input When App Not In Focus:
    https://guavaman.com/projects/rewired/docs/RewiredEditor.html#Settings

    "Ignores input if the application is not in focus. This setting has no effect on some platforms.

    NOTE: Disabling this does not guarantee that input will be processed when the application is out of focus. Whether input is received by the application or not is dependent on A) the input device type B) the current platform C) the input source(s) being used."

    Unity itself must be set to run in the background or this setting will have no effect.
     
  16. LithiumFox

    LithiumFox

    Joined:
    May 6, 2020
    Posts:
    5
    Of course, I already set that in Unity, but wanted to be sure before I reinstall the module into my project. I still have yet to get a working system but I'll give that a try!

    It's Windows, Direct Input device (T300RS). So I'll give it a try and see. Biggest problem is I need it to be detected while providing focus to my main application. Worst case scenario, I might just be able to use the in-game API to draw the wheel from in game detection but there's a delay in that, hoping to get 1:1 with what's actually happening

    I'll play around and see what happens. Thanks!
     
  17. LithiumFox

    LithiumFox

    Joined:
    May 6, 2020
    Posts:
    5
    Okay so success. 90% there.

    Only issue I'm having is unity itself or Rewired (i have 0 idea which) is I think reporting an auto-center value to the wheel. The problem is, well, I'm using this as a background application. So it makes my FFB extremely heavy for some reason.

    But I will say it is working in the background. Example: https://t.co/rGVQMA2jMC / Twitter
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    Rewired isn't doing it and Unity probably isn't either. Rewired simply reads what Raw Input or Direct Input reports to it. Rewired doesn't support sending HID reports to any devices except DS4 and Dual Sense controllers. XInput is a totally different API and is used for XInput controller vibration and only works with XInput-compatible devices. Any weird behavior of the device is likely caused simply by accessing the device through Raw Input rather than through the SDK. This sounds like the same thing that happens when you use a force-feedback wheel that only has drivers for Windows on MacOS .

    Even if you were to switch to Direct Input in Rewired, Unity would still access the device using Raw Input.
     
    Last edited: Mar 10, 2021
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    With the help of Unity identifying the problem (due to a change to IL2CPP), I was able to create a workaround that now fixes the UWP build issue. Unity will also be making a change to IL2CPP in a coming version to not throw a null reference exception in cases like this. I uploaded the update to the Asset Store tonight. Hopefully it will go live within the next few days.
     
  20. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    thanks! Waiting for the update to finally compile for UWP
     
  21. LithiumFox

    LithiumFox

    Joined:
    May 6, 2020
    Posts:
    5
    Gotcha. I'll have to figure that out at some point. I fixed the issue by simply disabling game controlled auto-center on the wheel itself.

    It works. :) Just gotta better understanding some of the mapping stuff so I can make it better now. Thanks!
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    Rewired 1.1.38.4 is available on the Unity Asset Store.

    See Updating Rewired before updating.

    1.1.38.4:

    Changes:
    - Updated Universal Fighting Engine 2 integration due to major breaking changes made in UFE 2.4.1 update.
    - Updated Bolt integration implementing workaround to prevent Rewired Bolt DLL containing custom units from being stripped from project in IL2CPP builds resulting in deserialization errors.
    - Windows 10 Universal: Added workaround for new bug in IL2CPP that causes builds to fail in Unity 2020.2.x and later.

    Full Release Notes.
     
  23. Jasinka

    Jasinka

    Joined:
    Oct 18, 2016
    Posts:
    50
    Hello guys,

    I have question. It is possible map very simple device like -

    I have problem with it. Can't find anything. Added keyboard map with letters, TT joystick maps, uknow joystick maps with buttons and axis and working just B buttons, thats all... It's possible to do working device or i am missing smth?
    Gamesir g4s is working and mocute working too.
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    You can expect ZERO support from me insulting me and my work like that. Rewired has the equivalent of over 600 pages of documentation and tons of examples that cover nearly everything one could want to do with the system including remapping controls. It has been said countless times by people that Rewired's documentation are the most thorough of any asset on the Asset Store. If you don't want to put in any effort into looking through documentation or the examples, that's on you. It's no reflection of the quality of my documentation. Get a refund through the Unity Asset and use some other input system.
     
    Last edited: Mar 10, 2021
    Mitch_Heinsenberg and BTStone like this.
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    That controller is an Unknown Controller:
    https://guavaman.com/projects/rewired/docs/SupportedControllers.html#controllers-without-definitions

    Unknown Controllers can only be supported via runtime mapping by the user.

    It's very unlikely that some buttons wouldn't work on the controller and others would. Open the Control Mapper demo scene and see if you can map all the buttons.
     
    Jasinka likes this.
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    Maybe you should learn to read.

    If you think "Rewired docs are absolute atrocious and useless" is some how useful "criticism" and "pointing out real issues", you're living in an alternate reality.
     
    Last edited: Mar 11, 2021
    BTStone likes this.
  27. Jasinka

    Jasinka

    Joined:
    Oct 18, 2016
    Posts:
    50
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    You have no clue what you're talking about. Thousands of UI menus? What???

    Documentation:
    https://guavaman.com/projects/rewired/docs/

    There are dozens upon dozens of examples of API usage including many example scenes on various topics that include source code, dozens of how to's, many with with example code, and even two complete, fully-functioning controller remapping systems with all the source code included.

    Control Mapper works perfectly fine when instantiated from an Asset Bundle. I just tested it and it worked exactly as expected. Just because you can't figure out how to make it work doesn't mean it doesn't work. Stop spreading false information.
     
    Last edited: Mar 11, 2021
  29. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    303
    How do you find out if a controller is Xbox, PS5, or something else? I have a current gen Xbox controller (the new Series X ones), and I'm playing on PC. I tried doing Joystick.GetExtension<XboxOneGamepadExtension>(), but it returns null. Does this work only for the older Xbox One controllers but not the current gen ones?
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    You will not find any examples of creating a controller map from scratch from code in the examples because that is not how the API was designed to be used. If it were, you would see that being done in example code throughout. All examples of working with controller maps in the documentation show controller maps being loaded into a Player from pre-defined definitions created in the editor, instantiated separately from pre-defined definitions created in the editor, loaded from saved XML data, or created directly in the Player as a blank map. Controller Maps are not intended to be created and manipulated outside the context of a Player and a Controller. Controller Maps also must always belong to an existing Map Category and appropriate Layout Id for the type. Controller Maps also contain many references (Player, Controller, etc) and cached/baked data from the controller definition for speed. Controller Maps and Action Element maps are not just structs you can go through and define properties on as you see fit.

    ActionElementMap.actionDescriptiveName and ActionElementMap.elementIdentifier name are read-only properties derived from the descriptive Action name defined in the editor and the controller element's names which are defined in the controller definitions.

    You make incorrect assumptions about how the API works, can't find information to match your assumptions in the documentation, then go on a public forum to cast aspersions about the quality of documentation. Instead of calling the documentation "absolute atrocious and useless" and accusing the person who wrote them of not doing his job, try learning the system you are using by actually reading the documentation and following its examples, and don't just assume the system works how you imagine it would if you had written it.

    If you don't like using an editor and insist on doing everything entirely in code, you had ample opportunity to evaluate every aspect of the system by using fully-functional free trial before you bought it. You didn't do the research and bought the wrong system. Get a refund and use something else.

    That's simply not true. I have no idea what you even mean by "hard references." Control Mapper uses standard Unity serialized object references. There's nothing "hard" about them. There is no other way to make object references in Unity. The reference to the Rewired Input Manager in the inspector is used for nothing but populating action, category, and layout names for editor inspector purposes. That reference is not used in any way in runtime code. All data is retrieved from the ReInput static class at runtime which represents the currently enabled Rewired Input Manager.
    1. Create a new project in Unity 2020.2.6f1.
    2. Install Rewired.
    3. DO NOT install Control Mapper when asked by the installer.
    4. Import the attached Unitypackage which contains the Asset Bundle, a scene, and the scripts required by Control Mapper. There are NO objects referenced by Control Mapper in this package. All Control Mapper objects are contained within the Asset Bundle.
    5. Open the Test scene, press Play, and press the button on screen to open Control Mapper. Do you see key bindings displayed? I do.
    ControlMapperInAssetBundle.jpg
     

    Attached Files:

    Last edited: Mar 11, 2021
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    https://guavaman.com/projects/rewired/docs/HowTos.html#identifying-recognized-controllers

    See this:
    https://guavaman.com/projects/rewired/docs/KnownIssues.html#xinput-device-name
     
    _eternal likes this.
  32. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    That's my issue and problem. Using them that way requires relying on Unity serialization, I want to be able to load it outside, not being tied to anything, or create programmatically.

    I see the canvas and its elements rendered but nothing populated.
    I'm familiar with the workflow, this is how I tested it as well.
    Looking at the code of UI.ControlMapper I see it searches in few cases and on initialization for the instance of global Input Manager object. I do have it in scene but for some reason it does not matter. Any ideas why?

    Correct, because of
    which you've just confirmed - your documentation does not have this information and this is what I've stated from the very start, yet you told me it DOES:
    So then I was right in my "casting ".

    I will consider InControl, thank you!
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    You're using the wrong system.

    Again, spreading lies. Where did I ever say that? Show me. You won't find it. I told you to read the documentation. Because if you had actually read the documentation, you would know how to use the system as it was intended to be used, which does not include throwing out the entire core editor system and coding everything yourself. Again, you didn't do a bit of research into what you were buying.

    Your original message, which has now been deleted:

    You should really learn to communicate. Creating a new controller map at runtime and replacing the entire editor system and all its functionality (Actions, Input Behaviors, Players, Controller Maps, Layouts, Categories, settings, etc.) are two entirely different things. It's easy to make a new blank controller map in a Player and add bindings. Replacing the whole serialized data system with code is what you are talking about. Anyone who could decipher that from your original message would be a mind reader.
     
    Last edited: Mar 11, 2021
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    New entries to the FAQ:

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

    Q: I don't like using visual editors and like to code everything myself. Can I use Rewired without using the Rewired Editor?

    Generally, no. The Rewired Editor is the heart of Rewired. The entire Player-Action system is dependent on data configured in the editor before runtime. If you want to use Rewired's Player-Action system (Controller Maps, etc.), you must configure the data using the Rewired Editor.

    The only way you could use Rewired without using the Rewired Editor to configure data is if you completely ignore the entire Player-Action system and read input directly from the Controllers, largely defeating the purpose of using Rewired.

    If you want to manage and configure every single thing in code instead of in an editor or you don't want to rely on Unity's serialization system for storing this data, you should use a different input system.

    Q: Can I create new Players, Actions, Controller Map definitions, Input Behaviors, and other data managed by the Rewired Editor through scripting in the Unity Editor instead of using the Rewired Editor?

    No. The Rewired Editor is the only supported way to configure the data stored in the Rewired Input Manager. The API for modifying this data through scripting is undocumented and partially internal. Rewired's data is intended to be configured using the Rewired Editor, not through scripting.

    Do not mistake this for meaning you cannot change settings and bindings at runtime. The developer-defined data stored in the Rewired Input Manager is static at runtime and cannot be changed, but the live instances created from that static data can certainly be changed at runtime through scripting. (Live instances include Players, Controller Maps, Input Behaviors, Rules and Rule Sets, etc.)

    Q: Can I create new Players, Actions, Controller Map definitions, Input Behaviors, and other data managed by the Rewired Editor at runtime?

    No. The majority of data stored in the Rewired Input Manager is totally static at runtime (everything except settings). Upon initialization, Rewired instantiates all objects in the system including Players, Actions, Input Behaviors, Controller Maps, Custom Controllers, Rules and Rule Sets, etc. based on what you've configured in the editor. The static data in the Rewired Input Manager cannot be changed at runtime. This means you cannot define new Actions, Players, Input Behaviors, etc. at runtime. However, the live instances of these objects (Players, Controller Maps, etc.) can be modified at runtime through scripting, and can even be saved to XML/JSON and reloaded at runtime. This means you can change controller bindings and various other properties at runtime and have those changes persist to the next game session.

    You could think of the data stored in the Rewired Input Manager as the "parent" data (similar to the Prefab system in Unity) and the runtime Players, Controller Maps, etc., as instances of their parent. The parent cannot be changed at runtime, but the instances can. Parent data (Players, Actions, etc.) can only be created or modified at edit time in the Rewired Editor.
     
    Last edited: Mar 12, 2021
  35. MisterDeum

    MisterDeum

    Joined:
    Apr 14, 2015
    Posts:
    24
    Hello @guavaman ! Quick question... rewired doesn’t seem to register the swapcharacter button of the corgi engine. Setting it as an action and mapping it doesn't work either. Where can you add more corgi engine buttons to rewired ... ?
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    Everything is in RewiredCorgiEngineInputManager.cs. At the time the integration was written, there was no such action as Swap Character in Corgi Engine. Copy the code, rename the class, and change anything you want. You also will have to add the new Action and bindings to the Rewired Input Manager.
     
  37. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    After upgrading Rewired I got the following error in the console:
    Rewired: Data files not found!
    ------- Rewired System Info -------
    Unity version: 2017.4.40f1
    Rewired version: 1.1.38.4.U2017
    Platform: Unknown
    Using Unity input: False

    Is this the same known issue as
    "Data Files is missing" error on the troubleshooting page:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#data-files-missing
    or is this a different issue?

    (I verified the ControllerDataFiles are assigned after installing Rewired again and no longer see the error in the console)


    rewired.png

    Thanks
     
  38. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    Is there anyway to disallow the user assigning button combos to actions? I don't want to allow something like "Shift+Return". But it would be OK to assign "shift" and "return" individually.
    Thanks.


    rewired2.png
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    That would never happen when upgrading because of anything Rewired is doing. Upgrading Rewired does nothing but overwrite the same files that existed before with the new versions from the Unity Package and then any installed extras are updated from zip files. Controller Data Files is part of the core Rewired and is included in the Unity Package. References to it are simply Unity object references handled like any other reference in the inspector for any other game object. Unity uses GUIDs to identify files in your project and the reference uses that GUID to find the file. Updating Rewired would never change a GUID of a file. Those GUIDs for the core files have been static for the 7 years Rewired has been out. If you have two copies of Rewired in a project somehow, Unity will generate new GUIDs for every file that has a GUID clash which would lead to all kinds of problems.

    Any kind of issue where object references break without cause is a Unity serialization problem. They've existed for years and have never fully been solved by Unity:
    https://guavaman.com/projects/rewired/docs/KnownIssues.html#serialized-data-corruption-after-import
    https://guavaman.com/projects/rewir...ialized-data-corruption-after-upgrading-unity
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    There is no option to disable that feature. You would have to change the source code to do this.
     
  41. DavidRodMad

    DavidRodMad

    Joined:
    Jan 26, 2015
    Posts:
    13
    Hi, I was trying to understand how to build a "press to join" screen and checking out the included example, but it doesn't seem to work correctly. The keyboard is never its own player, it's always controlling the same entity that one other controller does. Does rewired not support local multiplayer where there is 1 keyboard and 3 controllers, each device for one player?
     
  42. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    Hi,
    what's the fastest way to :
    1)enable/disable input for each player (or all)
    2)reset input (cancel any input received till now)
    thx
     
  43. MisterDeum

    MisterDeum

    Joined:
    Apr 14, 2015
    Posts:
    24
    Thank you very much !
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    Rewired supports most anything you want it to, but It doesn't do that automatically. The Keyboard (or a particular set of keys on the keyboard) is not a joystick and is not treated as one by Rewired joystick auto-assignment system. The Joystick auto-assignment system only assigns joysticks to Players based on the rules you specify.

    You have to manage keyboard maps in your Players based on how you decide the keyboard should be used. The only function that is useful to this end is excluding certain Players from joystick auto-assignment, assuming you want to exclude Player(s) that already have keyboard maps set up:
    https://guavaman.com/projects/rewired/docs/HowTos.html#excluding-players-from-joystick-assignment
     
    Last edited: Mar 16, 2021
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    1) It's much more efficient for you to track your own flags of whether or not to input should be read by your player scripts than to disable the input through the input system and you continue reading input.

    There is no "disable all input" option in Rewired.

    There are 4 things that go into determining value of an Action in Player:
    1. The Controller(s) assigned to the Player.
    2. The Controller Map(s) that binds Controller elements to Actions.
    3. If the Controller is a Joystick, the Calibration Map for that Joystick.
    4. The Input Behavior assigned to the Action.

    Various input paths can be disabled in many different ways.
    2) You can't reset input values:
    https://guavaman.com/projects/rewired/docs/FAQ.html#consume-input
     
  46. einWikinger

    einWikinger

    Joined:
    Jul 30, 2013
    Posts:
    97
    I've upgraded ReWired from 1.1.38.2 to 1.1.38.4 and I suddenly was greeted by internal VC++ compiler errors when doing a Windows Standalone x64 IL2CPP build. Unity 2020.2.4f1 with the same VS versions (14.16.27023) as before (am using one that does not have the new optimizer yet). I saw in the changelog there was a fix for a UWP IL2CPP issue, is there any workaround so standalone builds again?
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    The UWP issue was entirely different. They're not related issues. That was simply IL2CPP choking on the missing <Module> class in the UWP .Net DLL which is already included on all other platforms. Some update to IL2CPP caused it to try to get some information from that class without checking if it was null.

    All versions of Rewired are tested in IL2CPP builds prior to release with Visual Studio 2017 and all passed without issues. I have never heard of an IL2CPP build failure with VS 2015 or 2017. There's nothing I can do but attempt to reproduce it. What exactly does the compiler error say?

    Is this failing in the IL2CPP conversion step or afterward? You say VS is giving you compiler errors. If the code has already been produced by IL2CPP as a VS project and you are then trying to compile, IL2CPP has already run.

    Try clearing the IL2CPP caches from the Library folder in your project.

    I just tested 1.1.38.4 again in Unity 2020.2.6f1 IL2CPP direct build using VS 2017 (15.9.33) and there are no issues. I will have to uninstall VS 2017 to test VS 2015. I probably won't be able to get your exact version.
     
    Last edited: Mar 16, 2021
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    I have been testing everything I can think of to try to make it fail and I just can't. I set up Visual Studio 2015 on a different machine so there are no other versions of Visual Studio for Unity to use to compile. The latest update I'm able to get is 14.0.25431.01 Update 3. I cannot find any way to get a version that looks anything like your version of 14.16.27023. Every test I run builds to IL2CPP and runs without any issue.

    Is the only thing you did since the last time you tried to compile upgrade Rewired? Could there be something else in your project that changed? Seeing the exact error thrown by IL2CPP / Visual Studio might shed some light on this.
     
  49. dragonjuve

    dragonjuve

    Joined:
    Feb 11, 2021
    Posts:
    31
    Dear Rewired Plug-In support, we tried to re-assign a user when players change a user account via account picker in Xbox Live Game Core. However, even though we implemented the function above the Xbox controller becomes unusable.

    We also did check that the new and previous users both have different xuid, do you know the cause of this issue?
     

    Attached Files:

  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,608
    I received your email question already and will answer it as soon as I possibly can. I have been extremely busy today.

    Game Core Xbox is covered by NDA and cannot be discussed on this public forum.