Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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,500
    It sounds like you're trying to extend the ControlMapper class by inheriting from it. It was never designed for that purpose. Control Mapper is intended to be used as-is, and provides you a theming system and a bunch of inspector options to customize it. Customization by those means is the intended purpose. I should have made it a sealed class to prevent this use.

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

    If you want to modify the source code for your own purposes, you have to copy the ControlMapper.cs class, rename it, and replace the inspector reference to that class with yours. Then modify the code however you want.

    Separate examples for building your own systems are included for those that want to build a custom remapping system designed around the needs of their game. Customizing Control Mapper is not a very good approach because it's so full of complexity due to all the customization options, being a very general purpose system that could be used for any type of game. When building a remapping system for your own game, you would not need to build it with all the variability, making it a lot simpler. Similarly, making an extendable base system like Control Mapper with all that variability that can be extended by the user by inheriting from it would have made it extremely difficult to design, and very difficult to make changes to after the fact without breaking everyone's projects.

    Control Mapper redraws its items after pressing the Load Defaults button implicitly because it pops up a window asking "Are you sure?". This calls the function to close the child windows, which in turn calls the function to re-focus the main page. Re-focusing the main page calls Redraw.
     
    Last edited: Jan 13, 2022
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    This isn't a bug. You're using player.controllers.GetController incorrectly.

    You're passing 0 as if it's an index. It's not. It's an id:
    https://guavaman.com/projects/rewir...red_Player_ControllerHelper_GetController.htm

    Basic Usage:
    https://guavaman.com/projects/rewired/docs/BasicUsage.html

    "Id" is NOT an "Index"

    Anywhere the term Id is used in the API is a UNIQUE ID, not an Index, and cannot be used to iterate over items or get the first Joystick.

    Every new controller receives a new unique id.

    Type-organized lists of controllers are exposed in the same Player.ControllerHelper class. You must use these if you want to iterate controllers by index.

    https://guavaman.com/projects/rewir...Rewired_Player_ControllerHelper_Joysticks.htm
    https://guavaman.com/projects/rewir...Player_ControllerHelper_CustomControllers.htm

    How To's: Getting a Controller:
    https://guavaman.com/projects/rewired/docs/HowTos.html#get-controller

    You can loop through all controllers:
    ReInput.controllers.Controllers
    ReInput.controllers.Joysticks
    ReInput.controllers.CustomControllers
     
    Last edited: Jan 13, 2022
  3. crdmrn

    crdmrn

    Joined:
    Dec 24, 2013
    Posts:
    152
    I was trying to extend it by creating another partial class, which is supposed to work and be clean... and turns out it does, it was just unity being slow to pick up with VisualStudio, no idea ^^"

    About the controls InputGrid being in a weird position at start though, I still have no idea why that's happening and I'm not able to set it back to 0 even at the end of the spawn frame, any idea? :S
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    I see. That's somewhat safer, but the ability to add your own partial class definitions to extend it was an unintended side effect of making it a partial class so I could split up various logic over separate files.

    In order to figure out why the changes you have made aren't working, I would have to get your changes, figure out what you changed, and re-learn how the internals of Control Mapper work to debug it. It has been years since I wrote Control Mapper. Control Mapper was never intended for users to modify its code like you're doing or change its layout beyond the options available in the inspector, so this is outside the scope of support I offer for Control Mapper. Control Mapper's layout is a very delicate dance with Unity UI that took a very long time to figure out because of how all the various Unity UI components work including the order in which they redraw and calculate their own sizes under a variety of circumstances. Editing this layout significantly is going to require that you work out those same Unity UI-related issues I had to work out when I initially developed it. That's why this is in the docs:

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

     
    Last edited: Jan 14, 2022
  5. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,272
    Very happy with my purchase so far, and the documentation is excellent as well.

    One thing I couldn't find: Like many RPGs or RTS games, I have a dynamic action bar. You know, these icons at the bottom of the screen that you can click? Mine also have hotkeys 1-9 that you can press.

    These actions can change during the game. So key "1" can trigger different things, depending on the game's state, I can't just hard-wire it to a specific action.

    What's the best way of handling that? Should I set up 9 actions or can I combine them into 1 action and then query the actual key that was pressed? Should I have each button register player.AddInputEventDelegate() in OnEnable() and de-register via RemoveInputEventDelegate() in OnDisable(), or is it smarter to write a dispatcher script?

    What's the smartest way for Rewire to handle this?
     
  6. crdmrn

    crdmrn

    Joined:
    Dec 24, 2013
    Posts:
    152
    Don't worry, I'm aware that customizing ControlMapper to this extent was past its intent, I just thought maybe there was some layouting function I missed.
    Anyway, a much more straightforward question: is there any way to have ControlMapper save to a xml/json file and not into the playerprefs instead?
     
  7. little_box

    little_box

    Joined:
    Aug 22, 2017
    Posts:
    27
  8. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,548
    Can you provide more information for completeness.
    (1) What operating system are you running on?
    (2) Does the controller controller get detected by the operating system? (e.g. Windows calibration screen)
    (3) What input method is being used (e.g. if windows direct input, raw input and if you are using xinput)?
    (4) What version of Rewired?
    (5) What version of Unity?
    (6) The controller appears to be a wireless controller. Does it also have a wired usb mode? If it does have a wired mode does that work?
     
    guavaman likes this.
  9. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,548
    From the Rewired documentation you should look at MapCategories. I copied only small section but I believe that is what you are looking for ...

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

    >>
    Map Categories
    Map Categories are the first level of categorization of Controller Maps. Each Controller Map belongs to one Map Category and one Layout. The combination of the two serves to identify the Controller Map when selecting a Controller Map in the Rewired Editor or from the API.

    Unlike Layouts, all types of controller maps share the same set of Map Categories.

    Depending on your game's design, you may choose to use Map Categories for a variety of purposes. One example use would be for a game that has multiple different game modes. In such a game, Map Categories can help you organize controls for your different game modes easier. For example, if you have the following categories each of which correspond to a different game mode: System, Menu, Gameplay Shared, Infantry, Vehicle, Airplane. This allows you to have different control mappings for each game mode. You can use the category to determine which maps should be enabled/disabled when you change your game mode, for example going to the menu screen or getting on/out of a vehicle.

    . . .

    <<

    This is also helpful to look at.

    https://guavaman.com/projects/rewired/docs/ControllerMaps.html
     
    guavaman likes this.
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    Control Mapper doesn't handle data storage. That's handled by UserDataStore:

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

    UserDataStore_PlayerPrefs is the default and only included saved data storage component. If you want to store data differently, you have to make your own implementation of UserDataStore.

    The data being saved to PlayerPrefs by UserDataStore_PlayerPrefs is XML.
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    If a controller is not detected at all by Rewired, there's nothing you can possibly do to make it be detected. Detection of controllers is entirely handled by the low-level code interacting with the chosen input API's being used on the platform. If Rewired reports 0 controllers detected when it's plugged in, the input API's in use are not reporting it to Rewired and it cannot be made to work.

    However, it is very common that developers do not understand the input stack involved in making input work in Rewired. What on the surface may appear as the controller is not detected could really be anything in the input stack causing input not to work. The stack is explained here and a checklist is provided to walk through all levels to determine where the problem actually lies:

    https://guavaman.com/projects/rewir...l#debug-information-diagnosing-input-problems
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    This is implementation design. How you choose to implement something like this is up to you and there really is no "best" approach. I have never thought about this particular issue before and anything I tell you is simply my opinion based on the information I have.
    1. The 10 icons are fixed to specific key bindings -- 0-9 on the keyboard. The keys that activate each hotbar item do not change.
    2. The Action bound to each hotbar button / number key can change.
    3. The on-screen button must be able to be pressed by the mouse pointer to activate the Action, and potentially be clickable by different mouse buttons to activate different functionality.
    Approach 1:
    Off the top of my head, I might approach it like this:
    1. Create a Map Category for the hotbar.
    2. Create 10 Actions, one for each icon on the bar. Hotbar1, Hotbar2, Hotbar3, etc.
    3. Enable conflict checking of the Map Category for hotbar to all other Map Categories. https://guavaman.com/projects/rewired/docs/HowTos.html#conflict-checking
    4. Disable "User Assignable" on the Hotbar category to prevent the number keys from being rebound.
    5. Create a Keyboard Map in the Hotbar category and assign the 10 number keys to the Hotbar Actions.
    6. Assign the Keyboard Map to Player0.
    7. In your own code outside of Rewired, you manage and process the 10 hotbar Actions. Game logic executed by each hotbar Action is completely outside Rewired. Your code is responsible for handling:
      • Triggering some event when that Hotbar Action is activated.
      • Binding game functionality to a particular Hotbar button number at any particular time based on context.
      • Handling mouse left, right, middle clicks differently, mouse hover tooltips, etc.
    8. Optional: Create a Custom Controller with 10 buttons, a Controller Map that binds these 10 buttons to each of the Hotbar Actions, and pipe mouse input on the hotbar into the Action system using this Custom Controller. (You may want to create different Actions for right click, etc.) This is only necessary if want to process all the hotbar input through the Rewired Actions for consistency.
    The only part Rewired plays in this design is in binding the keyboard hotkeys for this hotbar to the 10 Hotbar# Actions. Everything else about the hotbar is completely outside Rewired and handled by your own code, not using Rewired Actions.

    Treating the Hotbar as something completely separated from the other in-game Actions defined in Rewired allows you to bind special functionality to the hotbar Actions that may not be possible, easy to do, or even make sense if you were to instead tie the hotbar items directly to in-game Actions. For example, the ability to right-click a hotbar item to get some other functionality, or the ability to execute some other alternate functionality under different circumstances. This also gives you more control over what Actions are and are not allowed to be bound to the hotbar, as there might be only certain Actions that you want available there.

    Again, that's only one approach that I just came up with on the fly. I was thinking of the hotbar in Ark Survival which has a lot of custom functionality that would not be achievable by binding a single in-game Action to each key.

    Approach 2:

    If instead you want the hotbar buttons to simply display whatever Rewired Actions is currently bound to that specific key on the keyboard, that's nothing more than displaying a glyph for bound Actions and that's documented here:
    https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action

    You will have to modify it somewhat because that is based on showing a glyph for an Action, but your version would be to show a glyph for an Action based on first knowing the keyboard key its bound to. The functionality for working with bindings is all there in the same classes. It should be a simple matter to find the Action Element Map that binds each of the number keys, then display a glyph for the Action bound to it.

    If you are working with it this way where normal Rewired game Actions are executed when the hotbar button is pressed or the corresponding key is pressed, then you can use the normal Rewired rebinding systems like Control Mapper to rebind keys. You could also swap out what is displayed on the hotbar based on current game context by switching the active Map Category being displayed by the hotbar. In terms of processing input, you would just read the value of the Rewired Actions from the Player as usual in your scripts and process them. There are some advantages to this approach, but also some limitations as noted above.

    I'm sure there are countless other ways you could implement a hotbar. Each approach may or may not be appropriate for your specific use case. I generally do not get involved in implementation design because of how broad and varied every game's needs are. That's why you won't find documentation in Rewired about topics such as this.

    You can do either approach. My opinion is 9 Actions is cleaner than listening for keys in your code. If you choose to use a Custom Controller, the same Actions can be processed for keyboard and mouse pointer input without changing any code.

    I don't see why the button would be reading input from the Player, unless you are intending for the button to process the functionality itself.

    Again, this is totally subjective, but I would design it so the player input processing script receives the input events and processes them. The button would just be responsible for triggering input events that would be processed in the player script.
     
    Last edited: Jan 17, 2022
    docsavage likes this.
  13. Egnech

    Egnech

    Joined:
    Aug 27, 2015
    Posts:
    27
    Hello there!

    The asset is great, worth every cent, but I really wish author has a dedicated forum, because it is almost impossible to find something here, and search by thread is not helping :'(

    Is it possible to clear, or reset button state from code? What I mean is at some point I need to GetButtonDown return FALSE, even if it was pressed at the at this exact frame. I need this to fix the issue when I'm closing the UI tab with the same button that activates the trigger behind the player, I believe it is very common situation xD
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    No, it's not. ButtonDown/Up aren't real events. They're states derived from comparing the previous frame's value to the current frame's value.

    There's a related FAQ item here:
    https://guavaman.com/projects/rewired/docs/FAQ.html#consume-input

    There are many ways to handle the button down problem you're describing. Here are a few off the top of my head:

    • Use GetButtonUp instead
    • Enable different Controller Maps when opening and closing the UI. If all Controller Maps that bind that Action are disabled, when re-enabled, the Down events will be silenced on the frame the Controller Map is enabled.
    • Use a Coroutine to delay re-enabling input after closing the UI.
    • Others.
     
  15. Egnech

    Egnech

    Joined:
    Aug 27, 2015
    Posts:
    27
    Thank you for the fast response. I think I'll go with separating Controller Maps and enabling/ disabling them. Sounds like the most clean solution for me.
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    I suggest you use this for the task:
    https://guavaman.com/projects/rewired/docs/MapEnabler.html

    And be aware, all bindings of the Action must be disabled in the Player for the Action to enter the "sleep" state, after which when it is awakened, the ButtonDown event will be silenced. That means if the Action is Fire, you must disable all Controller Maps in the Player for all controllers and controller types that bind the Fire Action.
     
    Egnech likes this.
  17. BackToPass

    BackToPass

    Joined:
    Oct 14, 2020
    Posts:
    6
    Hello guys,
    I got issue when use PS5 controller in MAC os. I setup joystick map for PS5 and build it for MAC, but it not work, just X and squad button working. Also in that build PS4 controller work, even though PS4 joystick map not setup?
    Anyone have some ideas for that?
    upload_2022-1-21_8-49-26.png

    And when I debug when run editor on MAC, the PS5 be detected but, some button work like X, O, squad, Cross, Triangles, R1, L1, joystick left press, joystick right press. But joystick left, joystick right and Dpad, L2, R2 not work.


    And I see L2 R2 be axes??
     

    Attached Files:

    Last edited: Jan 21, 2022
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    Update Rewired:

    https://guavaman.com/projects/rewired/docs/ReleaseNotes.txt

    1.1.41.3:

    Bug Fixes:
    - OSX Standalone, Native, Enhanced Device support enabled: Fixed Dual Shock 4 axes not working when connected via USB bug introduced in 1.1.41.2.
     
  19. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    I haven't found a clear solution to a problem I'm having. I'm upgrading a project from 2018 to 2019, and I'm getting two errors. Right now, I've got it down to this one:

    Assets\Rewired\Extras\ControlMapper\Scripts\UISelectionUtility.cs(39,68): error CS1615: Argument 1 may not be passed with the 'ref' keyword


    I haven't found a clear way to fix this. I've tried updating Rewired to current, as well as reimporting all assets. Any other ideas?

    The other message I was getting seems to have at least temporary cleared up after updating Rewired:

    Error: Could not load signature of Rewired.Editor.Component Controls.TouchInteractableEditor:GenerateInteractableAnimatorContoller due to: Could not load file or assembly 'UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:<unknown type> member:(null) signature:<none>


    EDIT: Actually, just restarted Unity and this second one has come back. All the help I see on this is "ignore it and it goes away", but I cannot even start my project. I know this is Unity's fault, from what I've read, but how can I fix it so I can get my project opening and working? Any ideas?
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    The first error is a compiler error and will not be fixed without changing that code. I dealt with that breaking change they made UISelectionUtility stop working a very long time ago, therefore this code has to be outdated. You updated Rewired. Did you also update Control Mapper after doing so? It should auto-update, but it can't do that if there are compiler errors. I suggest you delete the Control Mapper folder and reinstall it.

    Referring to the 2nd error: All problems like this are entirely dependent upon the version of Unity you are using. This is caused by Unity bugs and there is nothing I can do to fix the problems, nor can you do anything to fix the problems other than using a different version of Unity.
     
  21. ichiyaman_

    ichiyaman_

    Joined:
    May 30, 2019
    Posts:
    2
    Hi @guavaman, Thank you for publishing great asset that is very helpfully for me.
    I found curiosity behave on mac using SteamInput by PS4 controller on my environment.
    It looks like D-Pad Up,Down,Right and Left GetButton return like GetButtonDown.

    Rewired version: 1.1.41.3
    Unity version: 2019.4.34f1

    Have you ever heard of a these issue before? I should do to fix this problem.
    In case using override setting is no problem.
    Thanks.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    No, I have never heard of anything like this. Right away, you mentioning Steam, I would suspect Steam is causing the problem:

    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#steam

    What do you mean by D-Pad returns like Get Button Down?

    Are you saying the D-Pad only returns a non-zero value for a single frame before reverting to zero on the next frame?
     
  23. ichiyaman

    ichiyaman

    Joined:
    Jul 27, 2014
    Posts:
    1
    You are right. Example I keep pushing the button. GetButton return TRUE for the first frame, FALSE for all subsequent frames.
    I think that It's like GetButtonDown behave.
    This behave had only on Steam-mac using SteamInput.
    Same code correct works on Steam-Windows,PS4,Switch.
    Thanks.
     
    Last edited: Jan 22, 2022
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    Use Debug Information to view the actual value returned by the Controller's buttons instead of the Action you are querying.
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information

    This shows what's happening at the controller level.
     
  25. BackToPass

    BackToPass

    Joined:
    Oct 14, 2020
    Posts:
    6


    The current version of Rewired i using is 1.1.41.3, but PS5 still not working. My error about PS5, PS4 still working. Just PS5 can't use joystick.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    The same bug that affected the Dual Shock 4 also affected the Dual Sense and was fixed in 1.1.41.3.

    What you are describing to me is exactly what the bug fix was for. I just tested the Dual Sense controller again via USB and Bluethooth both with Enhanced Device Support enabled and disabled and have no problems with the axes working in MacOS Monterrey 12.0.1.

    I suggest you check the Rewired version in the Unity editor and be sure you really are using 1.1.41.3.

    Menu -> Rewired -> Help -> About

    If you are using Steam when doing this test, see this:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#steam
     
    Last edited: Jan 22, 2022
  27. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    I've just updated to the latest version and in unity 2021.2.8 and my joysticks stopped working. The game pad works fine but most joysticks are not working on Windows 10, compiling with Unity 2021.2.8 and 64 bits.
    Example joysticks that are giving wrong results on the axis:

    Thrustmaster T.16000m
    LOGITECH ATTACK 3

    So I tried to update to the latest version of Rewired to see if it's fixed. But then the upgrade doesn't work and it fails to install with this error (following message)
     
    Last edited: Jan 22, 2022
  28. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    I also get this weird error when loading the project
    Code (CSharp):
    1. Unable to update following assemblies:Assets/Rewired/Internal/Libraries/Runtime/Rewired_Core.dll (Name = Rewired_Core, Error = 131) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp7d8eec9c.tmp)
    2.  
    3. [AssemblyUpdater] Failed to resolve type 'System.Int32'
    4. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
    5. Parameter name: parameterType
    6.   at Mono.Cecil.ParameterReference..ctor (System.String name, Mono.Cecil.TypeReference parameterType) [0x00010] in <a6860a9f6366437387ebdc1f225b7fd4>:0
    7.   at Mono.Cecil.ParameterDefinition..ctor (System.String name, Mono.Cecil.ParameterAttributes attributes, Mono.Cecil.TypeReference parameterType) [0x0000b] in <a6860a9f6366437387ebdc1f225b7fd4>:0
    8.   at Mono.Cecil.ParameterDefinition..ctor (Mono.Cecil.TypeReference parameterType) [0x00000] in <a6860a9f6366437387ebdc1f225b7fd4>:0
    9.   at AssemblyUpdater.Steps.MemberReferenceReplacer.ParameterDefinitionFor (Mono.Cecil.MethodReference methodOwner, APIUpdater.Framework.Configuration.TypeReferenceSpec typeSpec, Mono.Cecil.TypeReference resolutionScope, Mono.Cecil.TypeReference originalParamType) [0x00027] in <455c1e4294254fa3b69b299f91ee635c>:0
    10.   at AssemblyUpdater.Steps.MemberReferenceReplacer.AddParametersToReference (Mono.Cecil.MethodReference reference, Mono.Cecil.MethodReference originalMethod, APIUpdater.Framework.Configuration.MemberReferenceReplacementConfig replacement, Mono.Cecil.TypeReference targetType) [0x000f5] in <455c1e4294254fa3b69b299f91ee635c>:0
    11.   at AssemblyUpdater.Steps.MemberReferenceReplacer.ResolveReplacement (APIUpdater.Framework.Configuration.MemberReferenceReplacementConfig replacement, Mono.Cecil.TypeReference targetType, Mono.Cecil.MethodReference originalMethod) [0x000c6] in <455c1e4294254fa3b69b299f91ee635c>:0
    12.   at AssemblyUpdater.Steps.MemberReferenceReplacer.Visit (Mono.Cecil.MethodReference methodReference, Unity.Cecil.Visitor.Context context) [0x000e6] in <455c1e4294254fa3b69b299f91ee635c>:0
    13.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.Cil.Instruction instruction, Unity.Cecil.Visitor.Context context) [0x0004d] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    14.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.Cil.MethodBody methodBody, Unity.Cecil.Visitor.Context context) [0x00092] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    15.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.MethodDefinition methodDefinition, Unity.Cecil.Visitor.Context context) [0x000e4] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    16.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Context context) [0x00177] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    17.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Context context) [0x001f7] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    18.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.ModuleDefinition moduleDefinition, Unity.Cecil.Visitor.Context context) [0x0001f] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    19.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.Cecil.Visitor.Context context) [0x0001f] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    20.   at AssemblyUpdater.Steps.AssemblyUpdaterStepBase.Visit (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.Cecil.Visitor.Context context) [0x00000] in <455c1e4294254fa3b69b299f91ee635c>:0
    21.   at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
    22.   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <d67d8e9ae2ea468c9e2ba2a6a509a7d7>:0
    23.    --- End of inner exception stack trace ---
    24.   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <d67d8e9ae2ea468c9e2ba2a6a509a7d7>:0
    25.   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <d67d8e9ae2ea468c9e2ba2a6a509a7d7>:0
    26.   at Unity.Cecil.Visitor.Visitor.Visit[T] (T node, Unity.Cecil.Visitor.Context context) [0x0001b] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    27.   at Unity.Cecil.Visitor.Extensions.DoAccept[T] (T definition, Unity.Cecil.Visitor.Visitor visitor) [0x00013] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    28.   at Unity.Cecil.Visitor.Extensions.Accept (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.Cecil.Visitor.Visitor visitor) [0x00000] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    29.   at AssemblyUpdater.Steps.AssemblyUpdaterStepBase.Apply (AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00012] in <455c1e4294254fa3b69b299f91ee635c>:0
    30.   at AssemblyUpdater.Core.AssemblyUpdaterPipeline.RunUpdateRound (AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00030] in <455c1e4294254fa3b69b299f91ee635c>:0
    31.   at AssemblyUpdater.Core.AssemblyUpdaterPipeline.Run (AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00007] in <455c1e4294254fa3b69b299f91ee635c>:0
    32.   at AssemblyUpdater.Application.Program.UpdateAssembly (AssemblyUpdater.Application.UpdateOptions config, AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00024] in <455c1e4294254fa3b69b299f91ee635c>:0
    33.   at AssemblyUpdater.Application.Program+<>c__DisplayClass0_0.<Main>b__1 (AssemblyUpdater.Application.UpdateOptions o) [0x00046] in <455c1e4294254fa3b69b299f91ee635c>:0
    34.   at CommandLine.ParserResultExtensions.WithParsed[T] (CommandLine.ParserResult`1[T] result, System.Action`1[T] action) [0x0001e] in <5f6458f0234f43a48c09047109c24684>:0
    35.   at AssemblyUpdater.Application.Program.Main (System.String[] args) [0x00048] in <455c1e4294254fa3b69b299f91ee635c>:0
    36. Assets/Rewired/Internal/Libraries/Runtime/UWP/IL2CPP/Rewired_Core.dll (Name = Rewired_Core, Error = 131) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp5e4bded2.tmp)
    37.  
    38. [AssemblyUpdater] Failed to resolve type 'System.Int32'
    39. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
    40. Parameter name: parameterType
    41.   at Mono.Cecil.ParameterReference..ctor (System.String name, Mono.Cecil.TypeReference parameterType) [0x00010] in <a6860a9f6366437387ebdc1f225b7fd4>:0
    42.   at Mono.Cecil.ParameterDefinition..ctor (System.String name, Mono.Cecil.ParameterAttributes attributes, Mono.Cecil.TypeReference parameterType) [0x0000b] in <a6860a9f6366437387ebdc1f225b7fd4>:0
    43.   at Mono.Cecil.ParameterDefinition..ctor (Mono.Cecil.TypeReference parameterType) [0x00000] in <a6860a9f6366437387ebdc1f225b7fd4>:0
    44.   at AssemblyUpdater.Steps.MemberReferenceReplacer.ParameterDefinitionFor (Mono.Cecil.MethodReference methodOwner, APIUpdater.Framework.Configuration.TypeReferenceSpec typeSpec, Mono.Cecil.TypeReference resolutionScope, Mono.Cecil.TypeReference originalParamType) [0x00027] in <455c1e4294254fa3b69b299f91ee635c>:0
    45.   at AssemblyUpdater.Steps.MemberReferenceReplacer.AddParametersToReference (Mono.Cecil.MethodReference reference, Mono.Cecil.MethodReference originalMethod, APIUpdater.Framework.Configuration.MemberReferenceReplacementConfig replacement, Mono.Cecil.TypeReference targetType) [0x000f5] in <455c1e4294254fa3b69b299f91ee635c>:0
    46.   at AssemblyUpdater.Steps.MemberReferenceReplacer.ResolveReplacement (APIUpdater.Framework.Configuration.MemberReferenceReplacementConfig replacement, Mono.Cecil.TypeReference targetType, Mono.Cecil.MethodReference originalMethod) [0x000c6] in <455c1e4294254fa3b69b299f91ee635c>:0
    47.   at AssemblyUpdater.Steps.MemberReferenceReplacer.Visit (Mono.Cecil.MethodReference methodReference, Unity.Cecil.Visitor.Context context) [0x000e6] in <455c1e4294254fa3b69b299f91ee635c>:0
    48.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.Cil.Instruction instruction, Unity.Cecil.Visitor.Context context) [0x0004d] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    49.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.Cil.MethodBody methodBody, Unity.Cecil.Visitor.Context context) [0x00092] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    50.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.MethodDefinition methodDefinition, Unity.Cecil.Visitor.Context context) [0x000e4] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    51.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Context context) [0x00177] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    52.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.TypeDefinition typeDefinition, Unity.Cecil.Visitor.Context context) [0x001f7] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    53.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.ModuleDefinition moduleDefinition, Unity.Cecil.Visitor.Context context) [0x0001f] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    54.   at Unity.Cecil.Visitor.Visitor.Visit (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.Cecil.Visitor.Context context) [0x0001f] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    55.   at AssemblyUpdater.Steps.AssemblyUpdaterStepBase.Visit (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.Cecil.Visitor.Context context) [0x00000] in <455c1e4294254fa3b69b299f91ee635c>:0
    56.   at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
    57.   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <d67d8e9ae2ea468c9e2ba2a6a509a7d7>:0
    58.    --- End of inner exception stack trace ---
    59.   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <d67d8e9ae2ea468c9e2ba2a6a509a7d7>:0
    60.   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <d67d8e9ae2ea468c9e2ba2a6a509a7d7>:0
    61.   at Unity.Cecil.Visitor.Visitor.Visit[T] (T node, Unity.Cecil.Visitor.Context context) [0x0001b] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    62.   at Unity.Cecil.Visitor.Extensions.DoAccept[T] (T definition, Unity.Cecil.Visitor.Visitor visitor) [0x00013] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    63.   at Unity.Cecil.Visitor.Extensions.Accept (Mono.Cecil.AssemblyDefinition assemblyDefinition, Unity.Cecil.Visitor.Visitor visitor) [0x00000] in <b1f3c010d8f14bc8acaca3627fbe519b>:0
    64.   at AssemblyUpdater.Steps.AssemblyUpdaterStepBase.Apply (AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00012] in <455c1e4294254fa3b69b299f91ee635c>:0
    65.   at AssemblyUpdater.Core.AssemblyUpdaterPipeline.RunUpdateRound (AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00030] in <455c1e4294254fa3b69b299f91ee635c>:0
    66.   at AssemblyUpdater.Core.AssemblyUpdaterPipeline.Run (AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00007] in <455c1e4294254fa3b69b299f91ee635c>:0
    67.   at AssemblyUpdater.Application.Program.UpdateAssembly (AssemblyUpdater.Application.UpdateOptions config, AssemblyUpdater.Core.AssemblyUpdaterContext context) [0x00024] in <455c1e4294254fa3b69b299f91ee635c>:0
    68.   at AssemblyUpdater.Application.Program+<>c__DisplayClass0_0.<Main>b__1 (AssemblyUpdater.Application.UpdateOptions o) [0x00046] in <455c1e4294254fa3b69b299f91ee635c>:0
    69.   at CommandLine.ParserResultExtensions.WithParsed[T] (CommandLine.ParserResult`1[T] result, System.Action`1[T] action) [0x0001e] in <5f6458f0234f43a48c09047109c24684>:0
    70.   at AssemblyUpdater.Application.Program.Main (System.String[] args) [0x00048] in <455c1e4294254fa3b69b299f91ee635c>:0
    71. Following assemblies were successfully updated but due to the failed ones above they were ignored (not copied to the destination folder):Assets/Rewired/Internal/Libraries/Editor/Rewired_Editor.dll    (Result = 0) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp7442906f.tmp)
    72.  
    73. Assets/Rewired/Internal/Libraries/Runtime/Rewired_WebGL.dll    (Result = 0) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp603fde46.tmp)
    74.  
    75. Assets/Rewired/Internal/Libraries/Runtime/Rewired_Linux.dll    (Result = 0) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp24a7547d.tmp)
    76.  
    77. Assets/Rewired/Internal/Libraries/Runtime/Rewired_OSX.dll    (Result = 0) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp6b3c8693.tmp)
    78.  
    79. Assets/Rewired/Internal/Libraries/Runtime/Rewired_Windows.dll    (Result = 0) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp675e0c1f.tmp)
    80.  
    81. Assets/Rewired/Internal/Libraries/Runtime/Rewired_Android.dll    (Result = 0) (Output: C:\Users\joaqu\AppData\Local\Temp\tmp5bf16a83.tmp)
    82.  
    83.  
    84. UnityEditor.Scripting.APIUpdaterLogger:WriteErrorToConsole (string,object[])
    85. UnityEditorInternal.APIUpdating.APIUpdaterManager:HandleAssemblyUpdaterErrors (System.Collections.Generic.IList`1<UnityEditorInternal.APIUpdating.AssemblyUpdaterUpdateTask>)
    86. UnityEditorInternal.APIUpdating.APIUpdaterManager:UpdateAssemblies ()
    87. UnityEditorInternal.APIUpdating.APIUpdaterManager:ProcessImportedAssemblies (string[])
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    Either a Unity regression or they never fixed the bug. This bug of theirs has been discussed in this thread:
    https://forum.unity.com/threads/libraries-that-fail-to-compile-on-2021-2.1144946/#post-7630990

    The fix was supposed to land in 2021.2 and the last update was Dec 1:
    https://forum.unity.com/threads/libraries-that-fail-to-compile-on-2021-2.1144946/#post-7700974

    I suggest you post in that thread and make a bug report. I cannot fix or work around this Unity bug.
     
  30. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    well, i can post but if unity keeps doing this and you can't do anything about it, we as customers will be forced to stop using rewired. We can't be so dependent on a single product when Unity decides not to fix something for months
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    I'm not sure what I'm supposed to tell you. I have absolutely no power to fix it. Rewired uses Texture2D. Unity has a bug in their assembly updater that chokes the Texture2D.Resize function if used in a compiled assembly. I can't just rip out the function calls and all the functionality that is dependent on that because Unity writes a bug in an update that causes my assembly to fail because I happen to need to use Texture2D.

    If you have to stop using Rewired because of a regression in a Unity update, then I'm sorry, but so be it. I can't fix it. I simply have no power to do so. While this affects you because you have to change input systems, it affects me by threatening to destroy my business as Rewired get the blame for a problem in Unity that I can't fix.

    I can't tell you how many times I've had to jump and scramble to patch over new bugs in every possible dependency under the sun including hardware, firmware, operating systems, distribution platforms, drivers, compilers, web browsers, etc., etc. I have kept this thing running under some of the most extreme circumstances, like when core Windows API functionality (Raw Input) started failing due to a Windows update, causing system crashes when using Xbox One controllers. I ended up rewriting entire swaths of code replacing it with an entirely new implementation of a different input API just to work around crashes with Xbox Controllers caused by Microsoft. It has become par for the course that I attempt to move the world to patch over bugs in dependencies that affect the user. My code is absolutely littered with workarounds for specific issues that have occurred over time in various dependencies, and most are no longer even relevant as they've since fixed their problems. The dependency suddenly stops working as advertised, I "fix" it by finding workarounds through days or weeks of trial and error testing. This is a very regular occurrence. This case is no different than any of the others, except for the fact that I simply can't "fix" it because there is no replacement for Texture2D. I have considered some extreme fixes like removing all Texture2D functionality including the entire Touch Control system, or Rewriting everything that may be dependent on Texture2D to use some kind of external bridge so it could be compiled by Unity instead of existing in the assembly (after pursing it, I decided I can't do it, lots of technical reasons), but why would I choose to break everyone's existing projects and dump advertised functionality when Unity has acknowledged the bug and said the fix was already in the pipes shortly after the bug was discovered?

    I will examine again what might possibly be done to remove dependency on this function, but I don't have much hope in "fixing" this one.

    Edit: It just occurred to me I can use reflection to call this function which would not be caught by the API updater because it doesn't modify reflected code (I hope)... This is exactly the kind of stupid, obtuse workaround my code is littered with because of dependency bugs.
     
    Last edited: Jan 23, 2022
    BTStone likes this.
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    I can't even explain why Unity is even running the API updater. I just installed Rewired in a new project in 2021.2.8f1 and I have zero errors and no messages from the API updater. I suspect whatever is happening here is an edge case involving upgrading projects. I have seen many cases of Unity doing things differently when upgrading projects vs starting a new project. There was a long-standing "issue" for multiple years where an error would be logged related to Unity UI that was fixed eventually, but would still show up when upgrading the Unity version. Based on what I'm seeing, it does look like they fixed the issue, but there must still be code paths under certain circumstances where the fix doesn't work.

    So what this means is, even if I implement a reflection-based workaround, I can't test it or verify it works because I can't reproduce the problem.
     
    Last edited: Jan 27, 2022
  33. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    I know what you mean. I mean, if you see my review about Rewired on the store, you have my 5 stars and I love the product. But at the same time, if a popular product such as this one, is not fixed for over 2 months by Unity, which means we cannot update (I have to use 2021.1.27 which came out in October) and miss out on all the new features of Unity.

    After 1 week it's a problem, 2 weeks is already very problematic, but 2 to 3 months and still waiting? Literally, we were stuck during the whole Christmas season with the previous version just because we couldn't update and lose Rewired input. I understand 100% it is not your fault but as devs, we are forced to make the choice between upgrading to Unity with all the new features or sticking to Rewired for who knows how many more Unity releases. In that thread, you can see I even provided a repro case for them to fix the bug, and... crickets.
     
  34. BackToPass

    BackToPass

    Joined:
    Oct 14, 2020
    Posts:
    6

    Hi @guavaman,
    I recheck and found that Rewired version in MAC not is latest version. So i update and it work.
    Thank you.
     
    Last edited: Jan 24, 2022
  35. nyonge

    nyonge

    Joined:
    Jul 11, 2013
    Posts:
    49
    @guavaman hi! Loving rewired :)

    Question, how can I open up a Rewired editor window from editor code?

    I'm writing a system that uses the name of an Action via string. Having a "View All Actions" button shortcut in my custom inspector would be suuuuuuper handy. Is this possible?

    upload_2022-1-24_13-36-5.png
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    No, it's not. Rewired's editor is not designed to be extensible or interacted with by user scripting. Most of its API is internal, and all of it is undocumented, unsupported, and prone to change without notice.

    See if this does what you need:
    https://guavaman.com/projects/rewired/docs/HowTos.html#actionid-property-drawer
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    I understand this is causing you problems being unable to use Unity's latest version, but two points:
    1. To be blunt, what really is the point in even stating it in the first place? If I literally can't do anything about the problem in Unity's API updater tool or remove the perfectly valid code that it's choking on (which I would not even have had a snowball's chance in hell to know what was causing the failure in the first place if it wasn't for Adriano from Unity debugging their API updater and discovering it's related to Texture2D.Resize -- the error has nothing to do with Texture2D. The error says something like System.Int32 is not a recognized class...), what do you expect telling me that you will have to drop Rewired if Unity keeps writing bugs that break Rewired will accomplish? It won't change the fact that I can't fix a new show-stopping bug in Unity. I can't drop dependency on Unity. Believe me. I would if I could. I can't rewrite Rewired every time they break something. All I can do is submit the bug report and attempt to look for workarounds if possible. This issue has been known since the 2021.2 was in beta, and I spent a lot of time testing and investigating possible workarounds at that time to no avail. I reported the bug. What more can I do? I am extremely frustrated about this situation, but as I've said, it is totally out of my hands. I don't have any special access to get Unity to jump and fix the problem breaking my asset.
    2. To be consistent, you would have to drop use of any and all 3rd party code, at the very least assets that include precompiled libraries, because ALL code external to Unity is subject to being broken by a Unity update with the potential there will be no way for the developer to fix it. There is no way the developer of an asset can predict, prevent, or have any control whatsoever what Unity will break or when. Look at what is causing it in this case -- Texture2D? That has absolutely nothing to do with input, yet it's enough to take Rewired down. And why? Because the of their API updater trying to run on a DLL that contains no outdated code. The same is true for any precompiled assembly that makes this same function call. This Unity bug has nothing to do with input and it has nothing to do with Rewired. This affects any asset that happens to contain this new land mine. Tomorrow it will be something else. That's all but guaranteed. Whether a viable workaround will be available for that next one is anyone's guess. If that's an unacceptable risk, I see no choice but to use only code you write and/or maintain yourself and find workarounds or remove functionality yourself when Unity breaks something important.
     
    Last edited: Jan 25, 2022
  38. guavaman

    guavaman

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

    See Updating Rewired before updating.

    Release Notes:

    1.1.41.4:

    Changes:
    - Added attempted workarounds to hopefully prevent API updater from seeing any calls to Texture2D.Resize in the Rewired_Core.dll assembly. A new Unity bug in the API updater in 2021.2 was causing it to crash on Rewired_Core.dll because of the use of Texture2D.Resize. This prevented Rewired_Core.dll from being loaded, completely breaking Rewired. The issue seems to be intermittent, not reproducible in every project, but in some projects likes ones upgraded from prior versions of Unity. This issue was not caused by Rewired but by Unity's API updater.
    - Changed Corgi Engine integration to use reflection to get value of base InventoryInputManager.InventoryOpen because of breaking changes changing the name of this field to InventoryInputManager.InventoryIsOpen with no way to branch code to support both versions.

    Bug Fixes:
    - OSX Standalone, Native: Fixed Xbox Wireless Controller (Xbox Series S/X controller) view button not working.
    - Control Mapper: UI no longer gets stuck in a bad state when changing language while a popup window is open.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    @creat327

    If this update doesn't fix it, nothing can fix it short of Unity actually fixing the bug in their API updater that caused this mess.
     
  40. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,739
    Thanks for the update. I'll try on the weekend since I had to roll back to 2021.1.27 again to be able to continue work.
    And I know what you are saying. Trust me, I was an alpha/beta tester of Unity for years and I've had so many angry interactions with them ignoring bug reports and fixes that I gave up and decided to drop Unity altogether. I don't recommend anyone to use Unity for any new game dev project, and I make clear that they constantly break stuff and don't fix it for months or even years. If they don't want to be in my situation (stuck with a game that I wrote with Unity or be forced to rewrite years of code into a new engine), avoid it completely. I'm sure Unity devs are not happy with my posts, but they don't seem to understand their customer complaints at all. I went from wearing Unity t-shirts and traveling to their conferences, to avoiding their software as much as I can. I would love to go back to loving Unity, but I just don't see it happening when they just break all my games with every single update, even when we report the bugs during beta.

    I hope after 3 months they finally fix the API Updater. But the damage is already done and from that thread you can see they don't care much either.
     
  41. homemacai

    homemacai

    Joined:
    Jul 22, 2020
    Posts:
    67
    Hello there, after the last update I now get these errors(img below) related to TMPro and the Control Mapper, not really sure why, any help would be appreciated. Rewired folder was not moved, and I also did the restart Unity step.
    Thanks!
     

    Attached Files:

    Last edited: Jan 25, 2022
  42. ch1ky3n

    ch1ky3n

    Joined:
    Oct 26, 2017
    Posts:
    51
    I can confirm homemacai issue also happens to me too

    Unity 2020.3.26f1
    Rewired 1.1.41.4 U2020

    Repro
    Create a new project, import TMP essential, Import rewired

    at settings add Controlmapper > using textmeshpro

    Assets\Rewired\Extras\ControlMapper\Scripts\ControlMapper.cs(1947,40): error CS1503: Argument 1: cannot convert from 'UnityEngine.TextAnchor' to 'TMPro.TextAlignmentOptions'

    Assets\Rewired\Extras\ControlMapper\Scripts\ControlMapper.cs(2044,48): error CS1503: Argument 1: cannot convert from 'UnityEngine.FontStyle' to 'TMPro.FontStyles'
     
    homemacai likes this.
  43. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    377
    Can we just take a moment and appreciate how awesome and helpful Guavaman a.k.a "The Rewired Sensei" is!! :D
     
  44. ch1ky3n

    ch1ky3n

    Joined:
    Oct 26, 2017
    Posts:
    51
    I agree, the developer is totally pro and I couldn't imagine how hard dealing with constant issues and changes. I'm reporting it with a good intention, you could just delete the control mapper scripts and it works totally fine!
     
    yakandco, guavaman and berkza like this.
  45. crdmrn

    crdmrn

    Joined:
    Dec 24, 2013
    Posts:
    152
    Can you point me at where to get that XML?
    I can't seem to find the corresponding string variable in the UserDataStore_PlayerPrefs.cs file ^^"
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    Sorry. My fault when I made a change to Control Mapper in 1.1.41.4.

    Either:

    ControlMapper.cs line 3:

    Change from:
    //#define REWIRED_CONTROL_MAPPER_USE_TMPRO

    To:
    #define REWIRED_CONTROL_MAPPER_USE_TMPRO

    Or download version 1.1.41.5 which is available now.
     
    homemacai likes this.
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    You will not find a single string in the file that represents the entire set of data. The file saves various XML strings in different PlayerPrefs keys. You will have to read through the source code to understand what data is being retrieved and how it is being stored in order to write your own implementation.
     
  48. crdmrn

    crdmrn

    Joined:
    Dec 24, 2013
    Posts:
    152
    Yeah I started to figure as I went through it, I just needed a confirmation, thank you! ^^
    One more question: I'm considering then creating am "aggregator" class to read-write to which will then be serialized to json/bin and saved/load. Would you say that is a good approach?
     
  49. Merrick20

    Merrick20

    Joined:
    Feb 20, 2015
    Posts:
    4
    Hi, @guavaman I was wondering if there's any way to change the Descriptive Name of an Action at runtime as to show a different language...

    I've been reading the how to's and found nothing, this is to change the language of actions displayed on the Control Mapper
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,500
    There is no generalized localization system in Rewired. Control Mapper has a system and it's right in the Control Mapper documentation under the heading "Language":

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

    Translating strings of Rewired objects (Players, Actions, Controller names, Controller elements, etc.):ADVANCED USERS ONLY

    Do not attempt to do this if you are inexperienced at C# or are a beginner with Unity. This is an unsupported feature and step-by-step guidance will not be provided.

    Rewired does not presently have a localization system built in where all strings in the system can be translated into different languages. Because I have been asked numerous times about how to translate these strings when using Control Mapper, I have added an interim translation framework to Control Mapper for you to be able to translate these items when displayed through the Control Mapper interface. If at some point in the future a core localization system is developed, this Control Mapper translation of these elements is likely to become obsolete.

    The LanguageData class provides framework for translating all the Rewired elements, but it does not provide a way to store the translation data. You will have to provide that part in an extended class. LanguageData merely provides an interface for Control Mapper to call into for all strings.

    In order to implement translation of these elements, you will have to override the LanguageDataBase class and extend it in order to plug in your translation and override each function pertaining to translation of Rewired core item names. Copy LanguageData.cs to a location outside the Rewired folder hierarchy, rename it to something else, change the class name to match, and modify all the functions below the line that reads "// Translation of Rewired core items" to translate the elements you want to translate using whatever lookup system you have set up for that. You will then have to make a ScriptableObject instance of your new extended class, then attach that to Control Mapper in the inspector so it uses it instead of the default language object.