Search Unity

Rewired - Advanced Input for Unity

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

  1. KhenaB

    KhenaB

    Joined:
    Aug 21, 2014
    Posts:
    267
    For the Sony Dualshock 4, there is a "Touchpad Button", I just played Bloodborne yesterday and they have two different actions for pressing right or left on the touchpad, I'm assuming there is a way to know where the thumb is on the trackpad, does Rewired support that?
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Only through the Controller Extension.

    Desktop platforms:
    http://guavaman.com/projects/rewired/docs/HowTos.html#dualshock-4-special-features

    PS4 platform:
    http://guavaman.com/projects/rewired/docs/HowTos.html#ps4-gamepad-special-features
     
    KhenaB likes this.
  3. NitromeSteed

    NitromeSteed

    Joined:
    Jul 28, 2017
    Posts:
    15
    Rewired appears to be broken in Unity 2017.4.18f1

    We are getting the same error as we would for using a 2018 install in a 2017 install - but I have literally closed Unity, created a new project, then immediately installed Rewired. A clean install is impossible, either it downloads the wrong Rewired or it is incompatible with Rewired for 2017. I don't know how to check for a version because Unity quickly becomes unusable with Rewired installed.

    It shows the usual PS4 input error preceded by:
    Code (CSharp):
    1. TypeLoadException: Could not load type 'Rewired.ReInput' from assembly 'Rewired_Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
    We're using this version of Unity because it's the current stable release for Nintendo Switch development. I've tested the compiler directives and UNITY_2018 doesn't show up, so it's not like they've messed up those flags (UNITY_2017 and UNITY_2017_4 both execute code). This build of Unity is the one currently highlighted in blue on the Nintendo Developer Portal if you want to verify this yourself.

    Can you recommend a workaround?
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Bingo. This is almost certainly this Unity Asset Store issue:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#wrong-rewired-version-installed

    The Unity Asset Store will automatically download the correct branch for the version of Unity you are using when downloading an asset. However, it does have bugs. If you have downloaded Rewired in a newer or older major version of the Unity editor, that version of the file will be cached in the Asset Store download location. The exact same download location is used for all versions of Unity from 5.0 onward, so when you switch to a different major version of Unity, the Unity Asset Store installer will install a copy of Rewired which was downloaded for a different version of Unity. The only solution is to delete the cached download and re-download it in Unity editor. See the Unity Manual for location of the Asset Store files.

    The above applies to newer versions of the editor as well. If you have Unity 2018 installed and have downloaded Rewired in it, you then open Unity 2017 and install it from the asset store and it will be installing the Unity 2018 version cached on your hard disk. The other error you posted is probably because the Unity 2018 DLL has some reference to a class or in the Unity 2018 API that doesn't exist in 2017.
     
    Last edited: Jan 18, 2019
  5. NitromeSteed

    NitromeSteed

    Joined:
    Jul 28, 2017
    Posts:
    15
    Deleted the Rewired folder from the Asset store cache and did a clean install. Everything works fine now. I did this with an empty project just to be sure.

    Thanks for the prompt reply, apologies for missing the info in the troubleshooting section.

    Anyone else finding this who has the same issue, delete the Rewired folder from your Asset Store cache.
    • macOS: ~/Library/Unity/Asset Store
    • Windows: C:\Users\accountName\AppData\Roaming\Unity\Asset Store
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Glad it's working.

    This Asset Store issue is the reason I put the warnings in there to tell you when you've installed the wrong version. The warning logged also contains this information:

    ...Some different major versions of Unity download Asset Store assets to the same folder location on disk, so if you download an asset in one version of the Unity editor, then open another version of the Unity editor and install the asset without re-downloading it, the wrong asset version will be installed. To fix this, manually re-download Rewired in the Unity Asset Store panel in this version of the Unity Editor, then install it....
     
  7. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    350
    Hey Rewired Sensa,

    So here is my problem. I'm building a fighting game, When I press START I want the game to pause. And It does, and thats great, I slow down time and bring up the PAUSE menu.

    But when I press the up and down, you know to scroll through the pause menu this also effects the characters FSM, for instance if I press pause when the character is in the middle of an attack and than I press down to scroll through the pause menu it also tells the character to go down or whatever...

    My solution for this was to change the PLAYER IDs to a high number (when the pause menu was active) so that the input wouldn't work on the players when the PAUSE menu was active. And this worked great. But now something happened and it does not work anymore. I now get an error that says:

    P1_NINJA : FSM : IDLE RIGHT : IntCompare : Rewired Player Id is out of range... Do you know why this happened.

    Do you have any suggestions ? Or a better solution for my problem ? Mind you I cant just turn off the FSM because than when I would turn it back on it would take it back to IDLE. And The idea is to pause the game and than un-pause it and pick up where I left...
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    You have many options. The most obvious that come to mind:
    1. Flow control your scripts with a boolean. Before processing input, check if input is allowed before processing.
    2. Disable non-ui controller maps when the UI is open: http://guavaman.com/projects/rewired/docs/HowTos.html#enabling-disabling-controller-maps
     
    XCO likes this.
  9. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    350
    Your wisdom knows no bounds!!
     
  10. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,636
    I'm using rewiredPlayer.GetAxis (RewiredConsts.Action.CharacterRotate);
    to get the axis input. (Mouse/Controller)
    Is there a way to get the input without the sensitivity applied to the input?
    I just want to get the input without factoring in any sensitivity.
    Thanks.
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    No. You have to set your Input Behavior sensitivity values to 1.0 if you want the value unmodified by sensitivity settings.
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Rewired 1.1.22.0 is available for registered users to download immediately. If you'd like to receive early access to updates, please contact me here.

    Please see Updating Rewired before updating.

    1.1.22.0:

    Changes:
    - Added support for IL2CPP scripting backend on Windows Standalone and OSX Standalone platforms.
    - Changed editor detection of Rewired installation folder for compatibility with moving Rewired into a Package Manager package. Note: Using Rewired as a Package Manager package is not recommended and support for issues encountered when doing so will not be provided.
    - Modified Rewired Standalone Input Module and Touch Controls to remove checks for UnityEngine.Input.touchSupported in order to allow Unity Remote touch input to work properly when run on an editor platform that does not support touch input.
    - Updated SimpleControlRemapping example.
    - Updated SimpleCombinedKeyboardMouseRemapping example.

    Bug Fixes:
    - Added D-Pad mappings to Racing Wheel Template for Logitech G29.
    - Editor: Fixed null reference exception thrown when linking Rewired Input Manager to Rewired Standalone Input Module inspector for the first time.
    - Editor: Fixed null reference exception thrown when linking Rewired Input Manager to Player Controller inspector for the first time.
     
    Bartolomeus755 and No0B25 like this.
  13. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,445
    For those Windows and OS/X standalone builds what is the minimum unity version required?
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    No specific version. Whatever version Unity first started supporting IL2CPP on that platform. Windows is 2018.1.0f1. I don't remember the version for OSX.
     
  15. OldLegWig

    OldLegWig

    Joined:
    Mar 18, 2018
    Posts:
    70
    Thanks for the response! I checked the debug info and it all looked correct. When I tried it again it worked without changing anything! There must have been something else going on. Again, thank you!
     
  16. shimenawa

    shimenawa

    Joined:
    Feb 20, 2018
    Posts:
    2
    I look forward to update my project to 1.1.22.0 for IL2CPP support.
    Could you tell me when is the estimated time of release in Asset Store?
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    I don't have that information. They approve updates on their own time schedule. Sometimes it takes 1 day, sometimes more than a week. It depends on their current log of submissions.
     
    Last edited: Jan 21, 2019
  18. shimenawa

    shimenawa

    Joined:
    Feb 20, 2018
    Posts:
    2
    I understand. Thank you.
     
  19. Deineri

    Deineri

    Joined:
    Apr 9, 2013
    Posts:
    1
    Are you aware that your documentation is currently not available on your website?
     
  20. raiskader

    raiskader

    Joined:
    Sep 27, 2018
    Posts:
    1
    Same problem, the rewired website does not work too, asks me to download a html file which can't be opened. I would have wanted to see the player mouse UI example
     
  21. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    155
    Question, in the latest release notes there is:

    Modified to detect Backquote and Quote keys on UK keyboard layout.​

    Is it possible to get the same fix for DE keyboards? Our DE users have to press Ö in order to trigger "KeyCode.BackQuote".
     
  22. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,445
    I have the same issue as both you with regards to the website documentation. Using FireFox 64.0.2 (64-bit) windows for reference.

    NOTE: I always install the Rewired documentation when the question is asked during the install process. Everything should be installed locally (on the filesystem) except the Rewired API information.

    So you can find the player mouse documentation here.

    file:///<install location>/Assets/Rewired/Documentation/Html/Examples.html#player-mouse-unity-ui


    The example code is located here:

    <install location>/Assets\Rewired\Examples\PlayerMouseUnityUI
     
  23. NitromeSteed

    NitromeSteed

    Joined:
    Jul 28, 2017
    Posts:
    15
    Looks like someone broke guavaman.com :(

    All pages except the home page are downloading instead of displaying in the browser. Nintendo Switch plugin won't update either - I cannot use Rewired, it's throwing errors and I installed it to test Switch joycons.

    Good luck fixing the site. Please give us an update when it's fixed.
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Webhosting issues. Nothing was changed on the website by me. Something has change on the webhost's end. Probably some server update or something that broke everything.

    Rewired does not require or use a connection to the internet for anything. The Nintendo Switch Plugin has an auto-update option, but internet is not required to use it. Contact me privately to discuss the Nintendo Switch plugin. Tell me what errors you are seeing.
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    The problem is PHP is no longer working on the server. I have reported it to the webhost.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    I have restored functionality to the documentation but the rest of the site is broken and I can't do anything about it until they fix php on the server.
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    This wasn't a fix. It was adding explicit support for a non-US keyboard layout to accommodate some user who wanted this. UnityEngine.Input doesn't support these keyboard explicitly -- you'll see the same behavior in UnityEngine.Input. Neither does Rewired because Rewired's keyboard support was modeled directly after UnityEngine.Input's to be 100% mapping compatible with UnityEngine.KeyCode. There was no plan to add explicit support for non-US keyboards to Rewired. This is one of those "if I do it for one, I have to do it for everyone" problems.
     
  28. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    155
    Ah, I understand that. Well, if you ever get crazy bored and decide "what layout to add..." feel free to add DE ;) Thanks anyways.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Rewired 1.1.22.0 is now available on the Unity Asset Store.

    Please see Updating Rewired before updating.

    1.1.22.0:

    Changes:
    - Added support for IL2CPP scripting backend on Windows Standalone and OSX Standalone platforms.
    - Changed editor detection of Rewired installation folder for compatibility with moving Rewired into a Package Manager package. Note: Using Rewired as a Package Manager package is not recommended and support for issues encountered when doing so will not be provided.
    - Modified Rewired Standalone Input Module and Touch Controls to remove checks for UnityEngine.Input.touchSupported in order to allow Unity Remote touch input to work properly when run on an editor platform that does not support touch input.
    - Updated SimpleControlRemapping example.
    - Updated SimpleCombinedKeyboardMouseRemapping example.

    Bug Fixes:
    - Added D-Pad mappings to Racing Wheel Template for Logitech G29.
    - Editor: Fixed null reference exception thrown when linking Rewired Input Manager to Rewired Standalone Input Module inspector for the first time.
    - Editor: Fixed null reference exception thrown when linking Rewired Input Manager to Player Controller inspector for the first time.
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    I'll add it to the list, but so many of these non-US keyboards are just not really compatible with the limited set of keycodes Unity has. And none of this is going to affect OSX, Linux, Windows UWP, Android, etc. as those platforms use UnityEngine.Input as the input source for all keyboard input unlike Windows which optionally has Raw Input support.
     
  31. LucidDreamsStudio

    LucidDreamsStudio

    Joined:
    Sep 21, 2018
    Posts:
    6
    Hello! I just updated to Rewired 1.1.22.0 as I wanted very much the IL2CPP support for Windows Standalone. Upon submitting the updated package using Collab, Unity Cloud Build does report an error on standalonewindows64. FYI, I'm building on both standalonewindows64 and standaloneosxuniversal, and the error is only happening with standalonewindows64 using Always Use Latest 2018.3 option.

    Here is the error I am getting:

    Code (CSharp):
    1. [Unity] Assets/Externals/Rewired/Internal/Scripts/Misc/ExternalTools.cs(85,20): error CS0234: The type or namespace name 'Windows' does not exist in the namespace 'Rewired.Utils.Platforms' (are you missing an assembly reference?)
    Any idea why I am getting this issue? I was on Rewired 1.1.21.3 and didn't had this problem. Thanks!
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    That would mean that the Windows library is not being loaded. The namespace it's telling you doesn't exist didn't exist in 1.1.21.3. That's all new for 1.1.22.0 and required. That means your libraries you are using are still from the old version while the scripts are from the new version. Delete the entire Rewired folder and reinstall it as described here:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#clean-reinstall

    Edit: Argh! Something has broken in the 2017 and 2018 packages and is causing all the platform-specific Standalone libraries to be included on every platform. This was NOT how the meta files were set up. That means this is going to be a problem for anyone downloading this. There's no explanation how these meta files got corrupted/changed, so I have no idea if it will happen again.

    go to Rewired/Interal/Libraries/Runtime/

    And change the plugin inspector settings on all Rewired_Linux, Rewired_OSX, and Rewired_Windows to only be built on the correct platforms...
     
    Last edited: Jan 22, 2019
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    The website should be working normally now.
     
  34. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    311
    Just noticed this in the release notes. Thank you for your stellar support of this asset, it's greatly appreciated.
     
  35. LucidDreamsStudio

    LucidDreamsStudio

    Joined:
    Sep 21, 2018
    Posts:
    6
    I updated to 1.1.22.1 and I'm having the same issue. On my desktop, I can create a build without any problem. However, I do have the same error when using Unity Cloud Build. Could it be that some defines are not set up properly in default Unity Cloud Build by the Unity team? This is really strange. As I said, the same code build is properly built without error with standaloneosxuniversal but I get the following error on standalonewindows64:

    [Unity] Assets/Externals/Rewired/Internal/Scripts/Misc/ExternalTools.cs(85,20): error CS0234: The type or namespace name 'Windows' does not exist in the namespace 'Rewired.Utils.Platforms' (are you missing an assembly reference?)


    So, 1.1.22.1 works fine locally on standalonewindows64 but fails on Unity Cloud Build.
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    If you look at the source code where it's throwing the error you will see this:

    Code (csharp):
    1. #if UNITY_STANDALONE_WIN || (UNITY_EDITOR && UNITY_EDITOR_WIN)
    2. return Rewired.Utils.Platforms.Windows.Main.GetPlatformInitializer();
    That means Unity Cloud Build is enabling the flags that tell scripts this is the Windows Standalone platform.

    The namespace it is complaining about "Rewired.Utils.Platforms.Windows" is included in the Rewired_Windows.dll. That would clearly indicate that Unity Cloud Build is setting the Windows Standalone flags but NOT importing the Rewired_Windows.dll that is set explicitly to be included on Editor and Standalone in Windows. I can not imagine this being anything other than a Unity Cloud Build or version control error and I don't see any way possible I can make it work. I don't have the ability to force a DLL to load. All I can do is set the settings in the inspector. Unity has to do the rest. This would also happen if your version control did not copy the new DLLs to the repository.

    As I explained here, 1.1.22.0 shipped with corrupted meta files on the Rewired_Windows.dll, Rewired_OSX.dll, and Rewired_Linux.dll causing them to be included on all Standalone platforms. In order to prevent the OSX and Linux DLLs from being included in a Windows build and opposite, each DLL must have its inspector settings changed so it is only included on the corresponding Standalone platform. Did you do this? There's no reason this would cause the Cloud Build error because there's nothing illegal about including OSX and Linux libraries in a Windows build (there are no overlapping classes), but it does waste space in the build.
     
    Last edited: Jan 22, 2019
  37. LucidDreamsStudio

    LucidDreamsStudio

    Joined:
    Sep 21, 2018
    Posts:
    6
    Yes I did this before even upgrading to the latest version (1.1.22.1). I will to yet another clean install and see if I still get the issue with the latest. Otherwise, I will poke the Cloud Build team about this.
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
  39. Zeitcatcher

    Zeitcatcher

    Joined:
    Dec 11, 2012
    Posts:
    21

    Facing the same issue with 1.1.22.1. Tried doing clean install twice (including restarting Unity after deleting Rewired, then again after re-import). Still getting
    ExternalTools.cs(85,20): error CS0234: The type or namespace name 'Windows' does not exist in the namespace 'Rewired.Utils.Platforms' (are you missing an assembly reference?)


    both locally and in Cloud Build logs. MacOS target is fine, problem is only with Windows target. Checked the rewired libraries — platform assignments are correct. Unchecked, rechecked proper platforms, reapplied, restarted Unity — same error. Switching back to MacOS — all good. Back to Windows — error again.

    Unity 2018.3.2f1
    Rewired 1.1.22.1
     
    LucidDreamsStudio likes this.
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    This can only be a Unity bug. I don't see anything I can do about it. It likely has something to do with Unity's selective DLL include process. Unity's going to have to be notified. Thanks for confirming it.
     
    Last edited: Jan 22, 2019
    LucidDreamsStudio likes this.
  41. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,636
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    This was caused by an update to Apache and PHP on my webhost. Everything should have been fixed yesterday. I can't reproduce this even in Firefox. Try forcing a browser refresh or clearing your cache.
     
    ArachnidAnimal likes this.
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Are you by any chance using ASMDEF files in your project?
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Wait, are you saying you're getting this error when doing a local build?
     
  45. Zeitcatcher

    Zeitcatcher

    Joined:
    Dec 11, 2012
    Posts:
    21
    Yes, but not for Rewired, not touching it.

    Yes, and the error appears even before attempting a build, it's always there in the editor console when Windows is the active build target.
     
  46. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,636
    I am updating rewired from 1.1.21.3 to the latest. I'm seeing some files, namely the ControlMapper.cs and related prefabs that are being overriden during the update. In the import selection dialog, I don't see anything obvious I've selected that would cause this to happen.

    1.png
    j

    2.png
    j
    3.png
    j

    I'm trying to figure out how to avoid this from happening as the ControlMapper.cs and prefabs have been customized at our end.
    Thanks.
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Control Mapper is updated by the editor script every time Rewired is updated. Control Mapper is not included in the Unitypackage base files. It is added as an option on installation. Once installed, the installer knows its installed and will updated it every time Rewired is updated by unzipping the Control Mapper zip package over the existing files.

    It is a bad idea to edit the original scripts (or prefabs) that come with Rewired (or any asset) for this reason. You should always make a copy of the scripts you want to modify, change the class name, move them outside the Rewired folder, and delete all the meta files so Unity can generate new file GUIDs.

    In this specific case, detection of Control Mapper being installed is done by file path. Simply moving the entire ControlMapper folder outside Rewired/Extras would make the installer think it's not installed and it would not overwrite it when you update Rewired.
     
    Last edited: Jan 22, 2019
    ArachnidAnimal likes this.
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    This problem is definitely not present without the use of ASMDEF files in a fresh project.

    If you have an ASMDEF file in any location above the Rewired folder, all scripts in the Rewired folder will be compiled into that assembly, not Assembly-csharp.dll. Therefore, that assembly will have to have references to Rewired_Windows.dll, Rewired_Linux.dll, and Rewired_OSX.dll or else it will not find those libraries and you will see errors like you're seeing. If the assembly that Rewired's ExternalTools.cs file is being compiled to does not have a reference to Rewired_Windows.dll, it will not be able to find the namespace or classes it's looking for and you would see this message.
     
  49. Zeitcatcher

    Zeitcatcher

    Joined:
    Dec 11, 2012
    Posts:
    21
    We don't have any parent ASMDEFs. I perfectly understand the consequences, that's why the only ASMDEFs we have are those already included in third-party assets by their respective developers. Right now I've reverted to 1.1.20.0 and it works fine (Windows & MacOS both Cloud Build and local).

    Also, when I was attempting second reinstall of Rewired today, I've left it in the root of the project, instead of /Extensions/ folder that we normally use for third-party assets, but that didn't help.

    I will try to reproduce in a fresh project, will report if I have any results.
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,772
    Does your Rewired/Internal/Libraries/Runtime folder happen to include both the following files:
    Rewired_Windows_Lib.dll
    Rewired_Windows.dll

    The first file is from the old pre-IL2CPP-compatible system. The 2nd file is from the new system. The old file should be deleted by Rewired when upgraded to 1.1.22.0. If the _Lib file exists, delete it. If the Rewired_Windows.dll file isn't there, the package did not import correctly.