Search Unity

Rewired - Advanced Input for Unity

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

  1. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    FYI... the demo version of Rewired gets blocked by Gmail, saying it presents a potential security issue. Any comment on that?
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    What do you mean by "correct assignments?" Is it that you want them assigned in order from left to right? There's no way Rewired can know which one is left and which is right. It will keep them in the same order it finds them. Whether this means right, left or left, right is dependent on the order the operating system sorts them. Unless there's some kind of data available through the HID information that denotes one being left and one being right like a different product id, there's no way to detect that.

    If you mean can you use both joysticks at once, yes.

    If you want to assign different in-game Actions to each joystick, you would need to be creative about how you configure your Controller Maps. A single joystick type can have many default Controller Maps created for it, but when the joystick is assigned to the Player, it will load the Controller Map defined in the Player if it is available for that joystick. Since both joysticks are identical, it will load the identical Joystick Map for both joysticks. Assuming this is a 1-player game, to get around this, you can do the following:

    1. Create 2 Players, one for Left and one for Right.
    2. Set up Player 1 to default to a Joystick Map that is laid out for the Left joystick.
    3. Set up Player 2 to default to a Joystick Map that is laid out for the Right joystick.
    4. Write all your input code to check for input from Player 1 and Player 2 simultaneously.

    You need to provide the user a way to assign joysticks also in case the sticks get reversed so they can assign the correct joystick to the correct "Player."

    Alternately, you could do it like this but it may require manual user interaction each time they play:

    1. Create 1 Player.
    2. Setup a default Joystick Map that is laid out for the Right joystick.
    3. Setup an alternate Joystick Map using a Layout that is laid out for the Left joystick.
    4. Write some code to detect when 2 joysticks are attached and load the alternate Layout in the 2nd joystick.
    5. You may want to prompt the user and ask them if they're using a L/R joystick configuration and to press a button on the Left, then on the Right.

    Included user data storage systems like Control Mapper / UserDataStore_PlayerPrefs are not going to work well for this because they only save data per-joystick-type and cannot save separate user data sets for multiple identical joysticks in the same Player. You could write your own that may work for this however depending on how you choose to achieve it from the methods above.

    Try the free trial of Rewired as long as you want to see if it does what you need.
     
  3. Alexanderansoft

    Alexanderansoft

    Joined:
    Jan 5, 2015
    Posts:
    26
    How to customize buttons icons? Control hint
     
    Last edited: Apr 10, 2018
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I did not see the message before. Sorry.

    There's no reason it should say that and nothing I can do to prevent it.
     
  6. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    170
    Hey guavaman

    I am getting this error on xbox:
    Code (CSharp):
    1. Assertion failed: <i>XboxOnePlayer(192.168.0.19):4601</i> AwakeFromLoadThreaded has not been called 'Input Manager' (MonoBehaviour). Figure out where the object gets created and call AwakeFromLoadThreaded correctly.
    2. Stacktrace is not supported on this platform.
    3. (Filename: C:\buildslave\unity\build\Runtime/BaseClasses/BaseObject.cpp Line: 930)
    I had a similar error on my screen fader object, because I was using DestroyImmediate(this.gameObject) for new instances of objects in new scenes. I fixed it by changing the call to Destroy(this.gameObject). I think it might be caused by this on your input manager object too. Is there a way I can change it to do that?

    I am using Unity 2017.1.3p3 with the latest official rewired version.
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    When and how are you getting this?

    If this is during scene loading, that would mean you have a Rewired Input Manager in the current scene and a Rewired Input Manager in the scene you are loading so it has to destroy the new one before initialization or chaos would ensue. This is done with Object.Destroy, not Object.DestroyImmediate.

    Rewired does not use Object.DestroyImmediate anywhere in any game-side code. There are a few calls in the Editor DLL.

    This is clearly some Xbox One-specific Unity idiosyncrasy, I've never had a single report of it before so it's probably new, and I doubt there's a solution. The only thing I can tell you is to try following the guidelines in the Input Manager documentation for setting up a script to instance Rewired only as needed in your scenes:

     
    Last edited: Apr 18, 2018
  8. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Why does adding a Rewired Input Manager add 10 seconds to my scenes start up time?
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I have never heard of Rewired adding anywhere near 10 seconds to startup even on very, very old hardware. (Last test was 2-4 seconds on a 9-year old Core i7.)

    The answer to your question however is in the Known Issues documentation:
    Rewired increases compile time and load time after pressing Play in the editor

     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Is this an actual Xbox One build or a UWP build on Xbox One?

    I find a lot of posts containing AwakeFromLoadThreaded referencing UWP or WP8 builds:
    https://www.google.com/search?rlz=1...cTaAhVHj1QKHQphC5AQvgUIJygB&biw=1211&bih=1010

    This thread says a similar message is only logged in Debug builds and has no effect on Release builds:
    https://forum.unity.com/threads/win...efromloadthreaded-on-every-gameobject.339954/

    Unity also says this is an internal error and should be reported.
     
  11. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Well, I am not imagining it.
    If I create a new project, totally empty scene, it takes just under 2 seconds from when i press Play icon until it starts playing. If I then import your asset package, and add Rewired Input Manager, and then press Play, it takes around 12 seconds before play begins. If I disable the Rewired Input Manager, I get a 2 second start time again.

    In my project until now I've been using the Unity Input system, and although its been a pain to work with, it has worked as long as I specified which axis and joystick is which, and there were no additional delays. Rewired is also working fine too, from what I can tell from the calibration page.

    I have an i7-6700k and everything is running from SSD. Obviously this is not a delay in just loading in some config files... The answer is definitely not in your known issues.

    Edit: There may be something wrong within windows somewhere. If I run the "setup USB game controllers" it is very slow, sometimes not responding, and then works, then stops responding again. Funny that whatever it is only appears there, and with Rewired, and not in a few other games I tried). I will try and resolve this underlying issue and report back.
     
    Last edited: Apr 18, 2018
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Based on this statement, it could be something to do with Raw Input. Unity does not use Raw Input. Whether those other games you tried do or not would be dependent on how they wrote them.

    Things to try (one at a time to see which if any have an impact):
    1. Disconnect all controllers.
    2. Change the input source settings in Rewired: http://guavaman.com/projects/rewired/docs/RewiredEditor.html#Settings
    3. First try disabling Enhanced Device Support, Native Mouse Handling, Native Keyboard Handling
    4. Then try disabling Use XInput
    5. Then try changing the Primary Input Source to Direct Input
    6. Then try changing the Primary Input Source to Unity Input
    This could be a device, a driver, some new problem in Windows, or a lot more. There have been may driver bugs in the past in Windows updates that have affected either Raw Input or Direct Input but not XInput or direct HID device reading which explains why they affect some games and input libraries and not others. There have also been devices such as the Nvidia Shield controller that cause massive system stalling when used through Raw Input but not through other means.
     
    Last edited: Apr 18, 2018
    Innovine likes this.
  13. Glitch12

    Glitch12

    Joined:
    Mar 23, 2018
    Posts:
    29
    Hello @guavaman

    With the Rewired how to move mouse cursor in the menu Inventory with an Xbox joystick.
     
  14. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    170
    Yeah, its happening on a new scene load because of the duplicate rewired managers.

    What is the best way of doing this: "your script should check if a Rewired Input Manager already exists in the scene first."
     
  15. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    170
    None of those seemed to give any clear answers on why it is happening (I searched for it myself as well). I've also posted internally on their private forums. Yeah, its an actual Xbox One build. I might bug it, yeah.
     
  16. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    guavaman likes this.
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    If you mean moving the OS's cursor on Windows, OSX, Linux, etc., you can't. See the FAQ:

    FAQ: Can Rewired set the mouse cursor position?

    If you mean a virtual cursor, it is the same as moving anything else -- use the input value from a Player's Action to move your object. In this case, you are moving a sprite, but it's really no different than moving any other object in Unity. Rewired does not provide the layer for moving your object. It only provides the input values to you and you move the object through scripting or visual scripting.

    If you mean the active selection for Unity UI, use the Rewired Standalone Input Module and set up Actions for the horizontal and vertical UI movement and assign them to your Joystick Map.
     
    Glitch12 likes this.
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Code (csharp):
    1. if(Rewired.ReInput.isReady) return;
    2.  
    3. // Or
    4. if(GameObject.FindObjectOfType<Rewired.InputManager>() != null) return;

    Here is a super simple Rewired prefab spawner example.

    Code (csharp):
    1.  
    2. public class RewiredSpawner : MonoBehaviour {
    3.  
    4.     public GameObject rewiredInputManagerPrefab; // set in the inspector
    5.  
    6.     void Awake() {
    7.         if(Rewired.ReInput.isReady) return; // already spawned
    8.         GameObject rim = ((GameObject)Object.Instantiate(rewiredInputManagerPrefab));
    9.         if(rim.GetComponentInChildren<Rewired.InputManager>() == null) {
    10.             Debug.LogError("Rewired Input Manager component is missing on the prefab!");
    11.         }
    12.     }
    13. }
    14.  
     
    Last edited: Apr 19, 2018
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    No, they don't explain why it's happening. They're just more examples of similar errors. Discussion in those threads point to internal Unity issues with no workarounds. One also says it's largely cosmetic and won't appear in a release build.

    Your specific message mentions threading. I have a feeling they've changed something with regards to threading and scene loading, possibly due to changes for ECS (speculation). It could be getting called from another thread during level loading, then calling Destroy on the object from that thread which Unity must not like. I don't see any possible workaround I could do apart from possibly using a coroutine to delay the Destroy for one frame, but there's no guarantee that would work either. (I'd rather not do this as I really dislike flooding the codebase with dozens and dozens of workarounds for Unity bugs and platform bugs of all sorts from version 4.3 and up.)
     
    Last edited: Apr 19, 2018
  20. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    Is it a bad idea to buy this asset now, since Unity said that their new input system might be out by the summer sometime? I know they also said not to wait for it :/
    What is expected from the new input system, and what do you think the role of this plugin will be when/if it comes out?
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Unity's new input system is essentially in alpha state right now and will be a work-in-progress when it is released. I cannot give you a run-down of the differences between Rewired and this new input system. I suggest you follow this thread if you want more information about their new input system.

    I can only state that Rewired works on a ton of platforms with a ton of devices of varying types, is mature now, works on versions of Unity all the way back to 4.3, and is used by thousands of developers around the world. The feature set on the website shows what Rewired offers and there is a fully-functional free trial available for evaluation.

    Rewired will continue to exist and continue to be improved. If the new input system's back-end offers anything significant that Rewired can take advantage of on certain platforms (Android for example), it will be added as another input source option.
     
    Last edited: Apr 19, 2018
  22. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    170
    I've already added my own spawner code into every scene that needs it and it seems to have done the trick.

    Thanks again @guavaman.
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Great! Can you please report this bug to Unity?
     
  24. Andrei_S

    Andrei_S

    Joined:
    Oct 31, 2012
    Posts:
    11
    Hello @guavaman!
    We are using Rewired in our project and at some point we don't know when (we only noticed that today), our Input Manager script inspector is looking like this:
    rewired.PNG

    As you see, the "Launch Rewired Editor" button is not displaying and we have these fields instead. Could you help us understand what we are missing?
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    The only way this could possibly happen is if the custom inspector scripts in Assets\Rewired\Internal\Scripts\Editor\CustomInspectors were deleted or moved outside of the Editor folder. Unity is not building these scripts in the Assembly-CSharp-Editor.dll anymore due to some change. Custom inspectors cannot be used outside the Editor assembly.

    1. Did you move the Rewired folder into some special system folder like Plugins? Unity has had problems in the past with Editor folders in the Plugins directory and they could have regressed this.
    2. Did you setup asmdef files in your project incorrectly?

    Follow these instructions to delete and reinstall Rewired:
    http://guavaman.com/projects/rewired/docs/Updating.html#issues-when-updating
     
  26. Andrei_S

    Andrei_S

    Joined:
    Oct 31, 2012
    Posts:
    11
    Thanks! Somehow we lost the Assets\Rewired\Internal\Scripts folder entirely. After reinstalling, its working again.
     
  27. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    I'm running the trial version. I opened up the ControlRemapping1 example scene. There are no event system or Standalone Input Module that are present in the scene. I thought these were required to be in the scene for UI to operate.
    Thanks.
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Read about the example here (or look at the comments at the top of the source code):
    http://guavaman.com/projects/rewired/docs/Examples.html#control-remapping-1

    tl;dr - This is an old example that uses the legacy OnGUI system. Don't look at this example if you want to know how to use Unity UI. This example is only for showing the Rewired API for all this functionality. Look at Simple Control Remapping or Control Mapper for Unity UI examples.
     
  29. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    OK, thanks for the explanation.

    Right now I'm setting up the actions and maps, etc.
    When I purchase the full version, will I have to re-do the setup all of the actions and maps? Or will these remain after installing the paid version?
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    The data is identical. You install over it and it will just work.
     
    ArachnidAnimal likes this.
  31. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Maybe I overlooked something in the manual, but what I would like to do is to only allow certain actions to be performed by certain input devices. For example: the rotation should only be performed by mouse or controller. The rotation should not be performed by keyboard. Is there a way to make actions only be handled by certain input devices?

    ss4.jpg
    .
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    No. That is not an option of Control Mapper. It is designed to allow the user to map any Action to anything they want.
     
  33. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    I'm running into an issue when trying to assign a new input. I get the "x" is already in use and cannot be replaced message. This is only occurring when trying to assign an input which exists in the Default map. Maybe I set something up wrong?
    . ss5.jpg

    I setup the keyboard map.


    ss6.jpg

    When running, I select the input field for "Move Backwards" and press the "W" key, I get the above message, with no option to replace.

    Is it that a key can't be assigned if it exists in the "Default" map?

    .
     
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    You will only ever get this message if you've set up your conflict checking options to protect controls in a certain Map Category from re-assignment. See the Control Mapper documentation: http://guavaman.com/projects/rewired/docs/ControlMapper.html#conflict-checking
     
    ArachnidAnimal likes this.
  35. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    I'm having an issue with sensitivity calibrating of the sticks on my Logitech Rumblepad 2 controller (control mapper reports it as Logitech F710). The sensitivity setting is having no effect.
    When I call GetAxis for any of the sticks, it seems the rewired player is giving me some raw value, and not the calibrated input.
    Code (csharp):
    1.  
    2. var v = rewiredPlayer.GetAxis(RewiredConsts.Action.HorizontalRotation);
    3. var v2 = rewiredPlayer.GetAxisRaw(RewiredConsts.Action.HorizontalRotation);  
    4. Debug.Log("horiz rot: "+v+". horiz rot raw: "+v2);
    5.  
    Prints out:
    horiz rot: -1. horiz rot raw: -1

    Here is the debug info for the "Joystick".
    debugInfo.jpg

    Does anything look amiss here?

    Thanks
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    You can look at the real-time values of Actions in Debug Information as well:
    Players -> Player # -> Actions -> Action

    I can't reproduce this. It works as expected.
    1. What version of Rewired are you using? Window -> Rewired -> Help -> About
    2. What is your Input Behavior Joystick Axis Sensitivity for the Input Behavior assigned to this Action set to? If you have this set to 10, it will multiply by the calibrated value of 0.1 and give you 1.0.
    3. Is HorizontalRotation assigned to right stick x?
     
  37. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Thank you greatly for the support.
    This^ was the problem. I reset the value and is now working as expected.

    So the underlying issue I was having is I couldn't get axis to move fast enough using this controller. It seems the controller axis are clamped somewhere between [-1, 1], unlike the mouse? I'll just define some extra "boost" value in my script to allow the input to go faster. Not a huge issue.
    Thanks agin.
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Joystick axes return absolute values.
    Mouse axis return delta values.

    Use player.GetAxisCoordinateMode to determine which type is being used for the Action at present.

    Joystick axes are clamped to a -1 to +1 range unless Apply Range Calibration is disabled in the Axis Calibration.

    Setting your "speed" multiplier on the axis through scripting after reading the input value is the correct approach. Making the joystick itself return a value higher than 1 to move your object faster would be crossing the line between input code and gameplay code. The +/- 1 value the joystick returns is telling you the user is moving the joystick to its maximum extents. Then this value should be interpreted by your code as appropriate.
     
    ArachnidAnimal likes this.
  39. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    184
    The Export Constants feature is quite useful, but please consider updating it with the following:

    1. Allow the specified namespace to include periods. "Company.Game.Category" is a valid namespace, yet it gets converted to "Company_Game_Category" when the file is generated.
    2. Try to locate the previously generated file before asking where to save a new export. Ideally, it would store the last save location and file name, and look for that first. If the file wasn't found, it could then search the entire project for a file called "RewiredConsts.cs", and finally present the user with the current "Save File" dialog.
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Both have already been added for the next release (but not the part about finding RewiredConsts.cs)
     
  41. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Well, I've been AFK here for far too long... Regarding the Linux bug (?) that I reported, well, it seems not only I encounter it. Just dropped it to a friend of mine and he experiences it too. Just to remind, this bug involves GetButtonDown return multiple times per second if you hold it on Linux.

    I made a simple test build with that that only has an image in the center that changes when it receives GetButtonDown. Just hold the X key on your keyboard and observe how the sprite randomly changes all the time, which shouldn't happen.
    Here's the build: https://drive.google.com/file/d/1IjqAa0nMUeJ4R3aaNx5QsbtCV9ZtM4dp/view?usp=drive_web
    I can also drop the source if you want. Tested on 2017.4 LTS and 2017.3.f3, works in both of them.
     
  42. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    What distro and version of Linux are you using?
     
  43. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Ubuntu 17.04, also tested on the recent 18.04, still happens there
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    There's nothing on Linux that would be different from any other platform with regards to this. The GetButtonDown code is in the core DLL which is the exact same DLL on all platforms.

    The only ways GetButtonDown can return multiple times in a row:
    1. Your Action's Input Behavior's Button Down Buffer is non-zero. This is the intended purpose of this property.
    2. You are calling GetButtonDown in FixedUpdate and do not have Rewired set to update in FixedUpdate in the Rewired Input Manager -> Settings page.
     
  45. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Sorry, but neither of those are true. I couldn't find an error of my own for quite a bit and also seeing how it performs flawlessly on other platforms one could assume that this is a bug.
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    There's no way it could be a platform-specific bug. There's no platform-specific code for the calculation of GetButtonDown. Unless it is some kind of super weird Mono bug...

    Please check the value of your Input Behavior at runtime. You may be loading XML data unknowingly. If you're using Control Mapper or UserDataStore_PlayerPrefs, it saves and loads XML data including Input Behaviors. If you ever changed this setting at runtime in the past and that value was saved, it would be loading it. Clearing PlayerPrefs would get rid of it.

    Please send me the project file. I will PM you.
     
    Last edited: Apr 30, 2018
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Following up with the results from our PM conversation for anyone else watching:

    Okay, found the cause. It's a new Unity bug. They've had so many problems with input on Linux. I have had so many things exactly like this happen over and over in the last 4 years on Linux.

    Rewired uses UnityEngine.Input.GetKey for keyboard and mouse input on OSX and Linux (and Windows if you disable Native Keyboard/Mouse Handling).

    UnityEngine.Input.GetKey now toggles on and off in rapid succession frame by frame after a short key-repeat delay. You can see by this behavior that Unity has inadvertently changed to using a keyboard typing algorithm (or perhaps a different part of the API). This makes it so that the ButtonDown state becomes true every few milliseconds. Rewired doesn't use the Input.GetKeyDown state directly but calculates its own key-down state based on the previous and current values of Input.GetKey. Because Unity is telling Rewired that the key going on and off in rapid succession, Rewired translates this into GetButtonDown and GetButtonUp every few frames. There's absolutely no way around this other than writing a native keyboard library for Linux and replacing UnityEngine.Input for this portion of input.

    This only affects builds on Linux, not the Linux editor. This is a serious bug and I will report it to Unity. I don't know at which version they introduced this.

    Making a Linux keyboard input library is the only solution but will take quite a bit of time and won't be ready for the next release.

    The following script placed on an object in a blank scene will clearly illustrate it. Simply press and hold X and watch what appears on-screen.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class TestKeyboard : MonoBehaviour {
    6.  
    7.    List<string> log = new List<string>();
    8.    GUIText gt;
    9.  
    10.    void Start() {
    11.       gt = gameObject.AddComponent<GUIText>();
    12.       gt.anchor = TextAnchor.LowerLeft;
    13.       transform.position = Vector3.zero;
    14.       if(Camera.main.GetComponent<GUILayer>() == null) Camera.main.gameObject.AddComponent<GUILayer>();
    15.    }
    16.  
    17.    void Update () {
    18.        bool pressed = Input.GetKey(KeyCode.X);
    19.        string msg = "Frame " + Time.frameCount + ": X is " + (pressed ? "PRESSED" : "not pressed");
    20.        log.Add(msg);
    21.        if(log.Count > 30) log.RemoveRange(0, log.Count - 30);
    22.  
    23.         gt.text = "Press and hold \"X\"\n\n";
    24.         foreach(var s in log) gt.text += s + "\n";
    25.     }
    26. }
     
    Last edited: May 1, 2018
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Following up again with further testing and results:

    This appears to be a change in Linux as well as a change in Unity causing it.

    Tests with the following:
    Ubuntu 14.04 + Unity 5.0.0f4 = No issue
    Ubuntu 14.04 + Unity 2017.1.0f3 = No issue
    Ubuntu 14.04 + Unity 2017.4.2f2 = No issue
    Ubuntu 14.04 + Unity 2018.1.0f1 = No issue
    Ubuntu 14.04 + Unity 2018.2.0b2 = No issue

    Ubuntu 17.04 + Unity 5.0.0f4 = No issue
    Ubuntu 17.04 + Unity 2017.1.0f3 = No issue
    Ubuntu 17.04 + Unity 2017.4.2f2 = PROBLEM
    Ubuntu 17.04 + Unity 2018.1.0f1 = PROBLEM
    Ubuntu 17.04 + Unity 2018.2.0b2 = No issue

    The most important takeaway is that Unity has already patched the issue in 2018.2.0b2. The change causing this bug was added in some version of Unity after 2017.1.0f3.

    I will add this to the Known Issues documentation.
     
    Last edited: Apr 30, 2018
    MrG likes this.
  49. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    So Unity still needs to backport the fix to 2017.4.x LTS with Ubuntu 17.04, according to the table above.
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    True. I submitted a bug report on 2017.4.2 explaining it.
     
    MrG likes this.