Search Unity

Rewired - Advanced Input for Unity

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

  1. virgiliu

    virgiliu

    Joined:
    Apr 4, 2015
    Posts:
    46
    I'm already using Mono with .NET 4.x and VS 2017, so based on what you said I don't know what else I could try. It's weird that even a build of a project which has only Rewired in it has 10s freeze after the Unity splash. And the 10s freeze is consistent between Editor and build. I don't believe it's my hardware since I can run most modern games at 120FPS.

    Maybe it's because I'm using Unity Personal instead of Unity Pro?

    I'll keep digging into this, since it's very annoying to have such a delay whenever I want to test things in the editor, but I would appreciate some guidance on how to debug this issue. I could provide a timelapse video with me creating a project from scratch to illustrate the issue, if you think that would help.

    Edit: I took a look at the Player.log, and the only thing that pops up after the 10s delay is:

    Searching for compatible XInput library...
    Found Xinput1_4.dll.

    Could this be the reason?

    Edit2: I sent a build to a friend, for him it loads almost instantly. So the issue is on my system but I have no idea what. I ran it from an SSD, all drivers are up to date, I turned off antivirus and firewall, I disabled GeForce Experience overlay. I'll keep digging.
     
    Last edited: Apr 10, 2020
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Unity personal and pro are identical.

    That XInput message is from Unity, not Rewired.

    I would suspect some kind of device or driver then. What is plugged into the computer or paired with Bluetooth? Many Windows API functions are called by Rewired that are not called by Unity, especially dealing with Bluetooth devices. A stall in some Windows API function due to some device or driver behaving badly could easily cause this. Device problems are very frustrating. I've even had one person complain of audio problems with their speaker bar making ticking sounds. It turned out to be the speaker was ticking every time certain Windows API Bluetooth functions were called. Obviously, I couldn't "fix" it because it was a problem with the speaker, not the Windows API or Rewired.

    You didn't mention whether it happens in the editor or not.
     
    virgiliu likes this.
  4. virgiliu

    virgiliu

    Joined:
    Apr 4, 2015
    Posts:
    46
    Besides USB keyboard & mouse, I'm using an Xbox 360 Bluetooth controller, but even with the dongle removed the issue persists in Editor and build. I didn't ask my friend to test the project in the Editor since that would mean distributing Rewired to someone without a license. But since the build runs without issue on other machines except on mine, that confirms that the problem is with my system configuration.

    As you say, it's most likely a driver issue. Since I confirmed that this isn't cause by Rewired, I'll try to track down which device is causing the issue and report if/when I figure it out.

    Thank you for the assistance! :)

    Edit:
    I found it! It was my keyboard's (Corsair K70) USB pass-through that was causing it. Once I disconnected the keyboard and USB pass-through, the build and editor started playing almost instantly.
    And to top it all, once I reconnected the keyboard and USB pass-through in the exactly same ports, the problem didn't manifest again. So weird...

    Thank you again for helping me troubleshoot this!
     
    Last edited: Apr 10, 2020
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Yikes... That's really strange. That should simply function as a USB hub, which, incidentally Rewired has no awareness of since all device communication is handled through HID and Raw Input (or Direct Input + XInput depending on settings). I can't imagine what would cause that. Must be at the Windows or driver level.
     
    virgiliu likes this.
  6. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    You are awesome, Thank you!

    The character spacing I feel is one of the most important one, due to different font styles that # needs to be increased - in my case by a lot.

    Works great, Rewired is great.png

    Thank you
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Looks nice. Might want to shrink the font size though so CALIBRAT-E AND ASSIGN CONTROLL-ER don't wrap like that.
     
    zKici likes this.
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    For those following the IL2CPP Visual Studio 2019 compiler bug issue:

    I have tracked it down to the new optimizer used in VS2019.
    • This affects Release and Master builds, not debug builds.
    • You can disable the new optimizer in the VS generated IL2CPP build project by adding the following to the end of the IL2CPP command line:
      --compiler-flags=-d2SSAOptimizer-
    Option 1: Manual Build

    Steps:
    1. Set Unity Build Settings -> PC, Mac & Linux Standalone -> Create Visual Studio Solution
    2. Build
    3. Open solution in Visual Studio
    4. Right click the IL2CPPOutputProject project in the Solution Explorer and select Properties.
    5. Make sure you have the correct build Configuration selected at the top for the type of build you want to make (Master, Release, etc).
    6. Go to the NMake page
    7. On the Build Command Line field, add to the end (adding a space first):
    8. --compiler-flags=-d2SSAOptimizer-
    9. Compile
    10. Run
    11. No more infinite loops
    Option 2: Environment Variable

    On Windows, another easier way to disable the optimizer is to add an environment variable. Be advised, this may cause IL2CPP builds for other build targets to fail because I assume it will add the compiler option regardless of the build target:
    1. Click Start Menu
    2. Type environment
    3. Launch "Edit the system environment variables"
    4. Under "User Variables for USERNAME", click New.
    5. Set the variable name to: IL2CPP_ADDITIONAL_ARGS
    6. Set the variable value to: --compiler-flags=-d2SSAOptimizer-
    7. Press Ok.
    8. Close all copies of the Unity editor and re-open it.
    9. Direct IL2CPP builds (without creating VS solution) will now work correctly.

    Option 3: Editor Script (Probably the best solution)
    1. Download the DisableNewVS2019Optimizer.cs script attached to this post.
    2. Create a folder somewhere in your Unity project named Editor.
    3. Copy the DisableNewVS2019Optimizer.cs script into the Editor folder.
    4. Now IL2CPP builds on Windows will automatically have the new optimizer disabled, but it won't affect builds to other build targets.
    5. Note that you will get a compile error if you use this script and do not have Visual Studio 2019 installed as VS 2017 does not have this compiler flag option.
     

    Attached Files:

    Bartolomeus755 and Grumpy-Dot like this.
  9. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Hello,
    I just posted a question on your website, but I have no idea if it went through or not, so Ill copy it here:

    "
    Hello, Great product. I have been using it for years on my game Vector36.
    I have recently added Oculus Touch and Vive controller support. To get these controllers mappable and identified, I have switched to Native Unity as described in your documentation. They all work wonderfully. I have even added Custom Controllers to handle the motion and rotation inputs for VR cockpit controls. I am also happy to see other controllers being identified correctly in the input display.

    Now my XBox 360 controller triggers dont work appropriately, as I used to use XInput. You have a lot of documentation on the XBox controllers and this particular problem, but from what I can tell you can't have both full Xbox controller trigger support and identified VR controller support at the same time because vr controllers only work with Unity and Xbox controllers only work with XInput? Is this true, or am I missing something?
    "
    Thanks,
    Ryan
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    You are correct. Unity input is not native. Rewired only supports XInput in native mode which means Raw Input or Direct Input + XInput. You can't have Xbox vibration support unless you use native mode, and you can't have "Unity-mapped" VR controller support unless you are in Unity mode. Triggers should work regardless.

    And no, I didn't receive a support email with this question.
     
  11. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Thanks for the quick reply. I am using Chrome for your support website, and there was no indication that the support ticket was sent.

    Ok so, vibration is nice, but a low priority. My wired Xbox 360 controller no longer has a separate axis/direction for each trigger. They are reading the same positive axis, all the time.

    Everything else seems to be fine, its just the xbox controllers. I am afraid there will be similar problems with other controllers that I dont have as I go, so want to make sure the solution is solid.

    What Rewired settings do you recommend for giving full VR controller setup(Rewired Controller Supported), full joystick support with no axis errors(Rewired Controller Supported), full controller naming support (not just XInput Controller), and vibration?

    I am on
    Windows 7 - 6.1.7601 SP1
    Unity 2018.4.20f1
    Rewired latest

    edit:
    To be more succinct, How can I get my xbox 360 controllers to have proper Trigger mapping in Unity-mode, if Unity-mode is the only way I can get VR controller support?
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I just "fixed" Unity Xbox triggers in 1.1.30.1 due to an undocumented breaking change by Unity in 2018.3 that messed up Xbox controller triggers. Apparently I missed something on the Xbox 360 controller definition and not on the 4 other XInput-compatible controllers that have same issue. See attached. Extract to Assets\Rewired\Internal\Data\Controllers\HardwareMaps\Joysticks.

    Write you own Custom Controllers to support the VR controllers and use Raw Input + XInput for the rest. There's no other option if you want all the features. And if Unity decides to fix their bug/undocumented breaking change they made to the triggers in 2018.3, you triggers won't break. I strongly recommend this route over using Unity input. I only added support for those Unity-exposed VR controllers because I was asked to. I would have preferred not to because I do not recommend using Unity input and don't want to encourage people to do so because native input offers so much more with far fewer issues.

    There are other important features you lose out on by using Unity input like universal Xbox controller detection and support. Someone plugs in any of the hundreds of XInput-compatible controllers out there, if you're using XInput it will just work. If you're using Unity input, they're going to have to map their controller at run time.

    There are many other reasons to use native input instead of Unity input.

    There should be no problems. Nothing has changed on the server at all. I get many support emails every day.

    You have to scroll down after you send the email beyond all the text before the form to see the "Thank you - your message has been sent." message. I know it's odd.
     

    Attached Files:

  13. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Fantastic, great feedback. Will update the maps and let you know how it goes.

    I will continue to experiment with the VR controllers and attempt what you have described. I dread creating a custom anything within Rewired, but I have already started with the VR motion inputs, so might as well keep going.
    Cheers!
    Ryan
     
  14. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    There's no reason you should. It's not difficult. You make a Custom Controller in the editor with the number of buttons and axes you want. You create a Controller Map for that Controller just like for any joystick. You write a script that reads input values from OVR input and inputs them into the controller and detects when the controller is connected and creates the controller and assigns it to a player. It would be probably < 200 lines of code.
     
  16. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I'm trying to make it Auto Size for those 2 buttons, but it appears its not using the prefab FitButton or Button,

    Can you point me at the right direction where I should add this inn the code:

    TMPro.TMP_Text temp = button.gameObject.GetComponentInChildren<TMPro.TMP_Text>();
    temp.autoSizeTextContainer = true;
    temp.fontSizeMin = 3;
    temp.fontSizeMax = 30;
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Min/max size is already handled in the template. The problem is the buttons you're trying to change it on do not have Auto Size enabled in the Text Mesh Pro component. The Assign Controller and Calibrate buttons are not auto-generated. They are in the hierarchy of the Control Mapper game object. They should have had Auto Size enabled on them but they didn't. Change them in the hierarchy if it's not a prefab instance or replace the prefab by replacing Control Mapper again with the zip.
     

    Attached Files:

  18. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    new issue: The Open VR Controller Joysticks are not reading my mappings at all. I set them in the Rewired Input Manager, I reset the playerprefs, they find the controllers without a problem in the Control Mapper, but the presets are completely diffferent to what I set out in the Rewired Input Manager. It even maps some axis to buttons that I have intentionally left blank, like axis 0 and 1 to the thumb pad. Is it reading some default Template even though it recognizes them as Open VR?

    I am using Vive-Pre gear, if that makes any difference.

    If I set the controls In-game with the Control Mapper, I can map the buttons without too much drama. Example:

    Open VR Right:
    Grab - Button 5
    Trigger - Button 15

    Open VR Left:
    Grab - Button 4
    Trigger - Button 14

    I just cant get the Rewired Input Manager to create these as the default.

    Yes I am still using the Native Unity, I just want to exhaust this approach before switching.

    Edit: I have to install steamVR plugin, dont I?

    Edit 2: steamVR plugin has no effect. The Controls are labelled as "OpenVR Controller (Vive Controller DVT)"

    Edit 3: Looking into the hardware joystick map editor, its getting its information from the Windows Fallback I believe.
     
    Last edited: Apr 14, 2020
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    There are three possible explanations:
    1. You are overwriting the mappings in some script.
    2. You are editing the wrong Rewired Input Manager. It is not the same GameObject than is being used in your scene/build.
    3. You have edited the Rewired Input Manager instance and prefab separately and you have out of sync data. Your prefab instance is overriding what you're seeing in the prefab.

    Look at the mappings here instead of Control Mapper:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    FYI, Control Mapper cannot be used to map Custom Controllers. Control Mapper only exists to map Joysticks and Custom Controllers are not Joysticks. So if you're planning to use Control Mapper, then you're better off sticking with Unity input.
     
    Last edited: Apr 14, 2020
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    These VR controllers will use the Gamepad Template as shown here:
    https://guavaman.com/projects/rewired/docs/SupportedControllers.html#vr-controllers

    Any mapping created for the specific controller will override the Gamepad Template mapping. This is on a per-map basis. If you have multiple Controller Maps in different categories/layouts in the Gamepad Template and have those assigned to the Player, but you don't override each of those for the specific controller mapping, the Gamepad Template mappings will be used where there is no specific controller override.

    https://guavaman.com/projects/rewired/docs/ControllerTemplates.html
     
  22. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Nope, none of those things. I have been very careful to write only to the prefab source. I have no scripts that rewrite any mappings.

    I used the debugger, here are the results. Not identified and no hardware Guid but all raw buttons and axis are activating correctly.
     

    Attached Files:

  23. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    23
    Hi,

    is there any way to figure out from which map a buttonDown was registered? I'm getting two actions from the Start button and it's only happening on Android devices. I'm trying to figure out what's causing it (looked at all the maps, there's only ever one action assigned to Start), maybe multiple maps are active at the same time? Do you have any tips on how to best track down this error?

    EDIT: Using an XBox controller on Android.
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    This checklist would lead you to the cause:
    https://guavaman.com/projects/rewir...l#debug-information-diagnosing-input-problems


    fdasfds.png

    This controller is not recognized and therefore is an Unknown Controller, and therefore is not going to load the maps you create for anything but Unknown Controller.

    Why? Unity loves to change everything constantly, making it impossible to support it without constantly changing things in your code over and over again and writing code to detect all the various versions of their changes over time. What specifically? Look at the name the controller returns:

    "OpenVR Controller(Vive Controller DVT) - Right"

    And the Rewired controller definition expects:
    "OpenVR Controller - Right"

    They changed it and it broke. I don't know if the mappings are even the same since I can't verify. There's no way to fix this but to change the controller definition. Extract the zip to Assets\Rewired\Internal\Data\Controllers\HardwareMaps\Joysticks

    If the mappings aren't the same, then another definition variant is going to have to be made.
     

    Attached Files:

    Last edited: Apr 14, 2020
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    '
    The ultimate tip to solve almost any problem:
    https://guavaman.com/projects/rewir...l#debug-information-diagnosing-input-problems

    Look at the loaded and enabled Controller Maps and look for any binding to Start. If nothing else is mapped to start, then it's probably the controller returning multiple buttons for Start. Look at the Controller -> Button values as you press them. If multiple buttons or keyboard keys are going on when you press Start, that's the problem and could be caused by anything from Unity changes (I would not be surprised) to the specific version and build of Android you're using. That checklist will tell you how to find it. It won't necessarily be able to fix it because if it is a problem with Unity or the OS changing the mappings for buttons, nothing can fix that but figuring out what caused, more code changes to detect it and branch, and more controller definition variants as usual.

    There's also this but Debug Information is much more important and tells you far more:
    https://guavaman.com/projects/rewired/docs/HowTos.html#get-contributing-input-sources
     
  26. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    That worked perfectly, thank you. Developers like myself go to 3rd party support because Unity changes things so frequently. It's like spinning plates while they add more plates than they take away, so I completely sympathize with you.
    The good news is I am slowly getting more used to the internal features of Rewired as you have exposed almost everything you need to future proof.
    Input is hard work, but you are doing great and making everybody else's job just that much easier. It is very much appreciated. :)

    edit1: just saw the product name you changed to:
    OpenVR Controller([a-zA-Z0-9_ \)\(]*) - Right

    I read this as "OpenVR Controller(*F*** it*) - Right. Made me lol.
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    If it were only Unity. I cannot tell you the incredible time it takes to be constantly putting out fires and rebuilding the building as every dependency or marginally-related system under the sun constantly shifts and changes under you with breaking API changes, bugs, more bugs, even more bugs, new bugs that get fixed that I already "fixed" for them in my code, deprecations, new ways of doing things, new APIs, etc., including but not limited to Windows, Windows UWP, MacOS, iOS, Android, Linux (various distros), Nintendo Switch, Stadia, Xbox One, PS4, web browsers, Steam, Mac App Store, Visual Studio, Android Studio, various compilers, drivers for hardware on all desktop platforms, controller hardware revisions, controller firmware changes, Unity and all its various technologies and backends, Unity editor, Text Mesh Pro, Unity UI, asset integrations, and so many tangentially-related things I can't even think of them right now. Constant maintenance wasn't even a thought when I started out to make an input plugin. After doing this for over 5 years, I can safely say that 99% of the work involved in developing software like this has turned out to be maintenance and support, by far and away eclipsing actual software development. That I did not expect when I started this, nor was it priced in when I set the price 5+ years ago.

    Sound about right! :D It might be better to change it to just OpenVR Controller.* - Right in case there are other characters they may use in the controller names that I'm not aware of.
     
    Last edited: Apr 15, 2020
    reinfeldx likes this.
  28. vladimir-fs

    vladimir-fs

    Joined:
    Nov 28, 2019
    Posts:
    23
    Thank you! I'm looking into this now (making a build).

    This gave me an idea to try using the controller on in the OS (I'm using a Samsung Galaxy S10+ to test, it's running Android 10) and wouldn't you know it, the Start button on this XBox controller registers as a "Select" action (the same as pressing A on the controller). I'm gonna do more testing but it seems like the OS is determined that the start button should function as the A button. Is there any way around this that you know of?
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    You won't know what's happening until you see what's actually being returned for the controller by Unity.

    Build the Joystick Element Identifier scene in Rewired/DevTools/JoystickElementIdentifier. Look at what button values are returned for those buttons. If they're identical, there's no way possible to fix it. Report the bug to Unity.

    If they're not the same, then go look at the keyboard key codes returned by Unity when you press those buttons:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace Rewired.Testing {
    5.  
    6.     [RequireComponent(typeof(GUIText))]
    7.     public class KeyCodeTester : MonoBehaviour {
    8.  
    9.         private int[] values;
    10.  
    11.         void Awake() {
    12.             values = (int[])System.Enum.GetValues(typeof(KeyCode));
    13.         }
    14.  
    15.         void OnGUI() {
    16.             string s = "KeyCode Tester:\n\n";
    17.  
    18.             s += "\nUnity:\n";
    19.             for(int i = 0; i < values.Length; i++) {
    20.                 if(Input.GetKey((KeyCode)values[i])) s += ((KeyCode)values[i]).ToString() + "\n";
    21.             }
    22.  
    23.             GUILayout.Label(s);
    24.         }
    25.     }
    26. }
     
  30. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    After upgrading from Unity 2019.2 to Unity 2019.3.9f1 there is major input lag. What I mean is that the inputs are buffered for up to 2 seconds - for example, I will rotate my mouse left, but continue to look forward, and 2 seconds later my character will rotate as if I had moved the mouse at that later time.

    I updated Rewired to the latest version but it did not fix the problem.
     
  31. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    It seems to be this same bug
    https://forum.unity.com/threads/mouse-keyboard-input-lag.791523/
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    RakNet likes this.
  33. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I double checked and pretty certain those are auto created on run time. The prefabs have auto size enabled now, however in the Control mapper menu prefab, those 3 buttons are not there.

    So they get auto created, and would like to know where in the script it does that so I can modify it for auto size enabled perhaps or is there a better way to tackle this?
     
  34. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311
    Hey,

    Is the CSV listing all supported joystick element IDs linked on this page still correct?
    https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action-template-specific

    The Element Ids are listed as follows:


    I'm working on Input glyphs, and when I mapped our Dualshock 4 glyphs to these values, it came out totally wrong. If I log the Id of each Element in controller.Elements for a Dualshock 4 and an Xbox 360 controller, I get the following values:



    I logged these with the following code:
    Code (CSharp):
    1.  
    2. Player p = ReInput.players.GetPlayer(0);
    3. //Just gets the first controller
    4. var activeController = GetActiveController(p);
    5.  
    6. string csv = "";
    7. foreach (var elements in activeController.Elements)
    8. {
    9.     csv += $"{elements.elementIdentifier.name},{elements.id}\n";
    10. }
    11. Debug.Log(csv);
    12.  
    Is an individual controller's Element Ids different to the template element ids? If so, how can i easily retrieve the template of a controller so that these IDs are equivalent between joysticks? (I.e. Cross on the returns the same Element ID as A on the X360). Basically I want to go through all the Actions, get their mapping, then look up the glyph from the element Id. Ideally I want to get the icon for that gamepad if I have it, and otherwise fall back to my default (which will be the X360) glyphs. Thanks!
     
  35. virgiliu

    virgiliu

    Joined:
    Apr 4, 2015
    Posts:
    46
    Should I expect any significant performance hit if I call GetLastActiveControllerType() on every frame, inside Update()?
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No, they aren't. Those two buttons are not instantiated at runtime. They are static buttons included in the GameObject hierarchy and they do not have Auto Size enabled in any version of the TMPro Control Mapper except the one I uploaded in the last message to you. I made the change myself.

    This picture was taken in the editor with Play mode disabled. This is the prefab that is copied when you create a Control Mapper. These objects are static and are not instantiated at runtime dynamically from button prefabs like all the input fields.

    fdsafdas.png
     
    Last edited: Apr 16, 2020
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No.
     
    virgiliu likes this.
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Yes.

    Yes.

    You can't. Each joystick is different and has its own unique list of IDs. A Template is nothing but a mapping from the Template Controller Map to a Controller Map defined for the specific id list of that controller. If you want to go from the Template ids to the Controller ids or vice versa, you have to go through steps. There is not as a 1:1 relationship to Ids on Templates and Controllers. Any Template Id may map to multiple controller element Ids or vice versa (split axes, sticks to Dpad mappings, etc.). All this is covered in the Controller Template documentation and the examples provided:

    https://guavaman.com/projects/rewired/docs/ControllerTemplates.html#scripting
    https://guavaman.com/projects/rewired/docs/Examples.html#gamepad-template-ui

    You don't use the Template if you're trying to make a glyph list for a specific controller. You use the controller's specific element identifier ids and make a table of glyphs:
    https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action-controller-specific

    You only use the Template if you want to display glyphs for any Template-compatible controller generically based on the Template and not show the glyphs specific to that controller.
    https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action-template-specific
     
    Last edited: Apr 16, 2020
  39. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311
    Great, thanks. I was unsure as an Action mapped to Action Bottom Row 1 on the DS4 reports an Id of 6, which on the template CSV is ActionBottomRow3, which is where my confusion stemmed from. I was expecting controllers that were compatible with a template to report shared IDs, but I see why that isnt the case now.

    Just to be clear, I should:
    1. Attempt to get device-specific glyphs from the device's GUID
    2. If this GUID is not in my list, see if it implements IGamepadTemplate with `ImplementsTemplate<IGamepadTemplate>() `, in which case use the Template-specific method, which can show my default glyph set.

    Finally, is there any way I can fake an Unknown controller being connected, to test how my system responds in that scenario?

    Thanks for your time.
     
  40. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Yeap, I was definitely blind to this.

    Sorry and thank you.
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    It's up to you. You don't have to make Gamepad Template glyphs unless you want to.

    No. There is no controller mocking in Rewired. Remove the controller definition for something you have or install some virtual joystick software to make a fake HID device:
    https://guavaman.com/projects/rewired/docs/HowTos.html#excluding-controller-definitions
     
  42. JalalGurbanov

    JalalGurbanov

    Joined:
    Sep 30, 2017
    Posts:
    16
    Hi there. I wanted to buy the asset in Spring Sale but it seems not On Sale. Do you plan to have a discount any time soon?
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired is already far cheaper than I should be charging for it considering the thousands of hours I've spent creating and supporting it. Rewired is not scheduled to ever be on sale again for the same reason. I decline Unity sale offers every time they ask.
     
    zKici likes this.
  44. JalalGurbanov

    JalalGurbanov

    Joined:
    Sep 30, 2017
    Posts:
    16
  45. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311
    Sorry I thought that was implied. I was asking more if that's the / a recommended way of falling back to compatible glyphs, because I can't see another way. The rest is already working.

    Great, thanks.
     
  46. Djaydino

    Djaydino

    Joined:
    Aug 19, 2012
    Posts:
    48
    Hi.
    Is there a way to translate actions?
     
  47. Djaydino

    Djaydino

    Joined:
    Aug 19, 2012
    Posts:
    48
    Hi again.
    Can I update Controller data files @ runtime?
    This is to update controller Element Identifiers, to update language.
    upload_2020-4-17_22-6-18.png
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    The most complete way is to provide both specific and Template glyphs, of course. But you can certainly get away without it. Making glyph sets for all the important controllers will cover most cases. Unknown Controller will be used for anything else, which you can create a set for as well.
     
    Last edited: Apr 17, 2020
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No. There is no localization system built into Rewired. You can't edit Controller Definitions at runtime, nor should you ever edit them in the editor as the changes will be overwritten when you update Rewired.

    Translation of Actions, controller names, controller element names, etc if you need that is a totally manual process. You will have to make tables of all the information you want to translate and look up the translation before outputting the information to the screen. You will not be able to do this with Control Mapper without modifying the source code, or write your own remapping screen.
     
  50. Djaydino

    Djaydino

    Joined:
    Aug 19, 2012
    Posts:
    48
    Hi.
    I found a way around with some small edit on the Control Mapper script.

    I used text.gameobject.name = with the 'label text' and 'label' on the ControlMapper.cs and ControlMapper_Classes.cs
    then at runtime when i open the mapper i use get all childs on the container
    Then loop thru them and check if it has a textmesh ugui component, if so get name of the object.
    Then use the name to get the correct language text on my hashtable system,
    and place the text on the textmesh object

    For the controller/mouse/keyboard it could work as well But i would need to update after each change.

    i am still looking where i could best to the reload any hint would be helpful :)

    Here's a picture of the test result during game (SC for Chinese :) )
    upload_2020-4-18_2-4-14.png

    I also tested control changes and that worked fine :)