Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rewired - Advanced Input for Unity

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

  1. Telestrator

    Telestrator

    Joined:
    Aug 21, 2018
    Posts:
    10
    Last edited: May 26, 2022
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    There has to be something else involved here. Rewired cannot possibly be affected by scene loading if the Rewired Input Manager is not destroyed. Unity's scene load cannot change anything in Rewired unless DontDestroyOnLoad is unchecked. Therefore, the symptoms you're describing have to be coming from outside -- some other script doing something it should not be.

    Have you watched what is happening with controller assignment using Debug Information when you connect, disconnect, and load a scene?

    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information

    This will tell you which Player each controller is assigned to at each of those points. If controller assignment is changing the moment you load the scene, then there is without a doubt something happening because of another script. My first suspicion is that you have Control Mapper in both scenes, which uses the UserDataStore_PlayerPrefs component, which happens to load configuration on Awake, by default including controller assignments. Unloading the first Control Mapper will delete it, then the next one in the new scene will cause saved data to be reloaded (this would also be logged in the console.)

    Otherwise, there has to be some script on a GameObject in the 2nd scene that is executing some code that is causing the problem.

    First, Rewired's player ids are zero-indexed. Player 1 would be index 0. Second, Controllers includes all controller types including Keyboard, Mouse, and Custom Controllers. Joysticks is the name of the property that contains what most people refer to as controllers.

    I don't recommend doing this because it's really just patching over the problem. Finding the source of what is causing it in your project would be the better way to fix it.

    Also, I suggest using the Rewired Initializer instead of having instances of the prefab in every scene. It's much cleaner and prone to fewer errors like having accidental prefab overrides in one scene but not another.
     
    Last edited: May 26, 2022
    Cambesa likes this.
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    There is currently no PS5 support. All supported platforms are listed here:
    https://guavaman.com/projects/rewired/docs/Overview.html#tested-platforms

    And all platforms that require plugins or additional libraries are listed
    here:
    https://guavaman.com/projects/rewired/docs/SpecialPlatformSupport.html

    I have been told someone made a C# patch and posted it on the PS5 dev forums
    that will make Rewired think it's running on the PS4 platform and therefore
    work for gamepad input (sans new features like trigger vibration.) This is
    not an official patch, but apparently it works for most use cases.

    You can also use the Custom Controller system to implement input on the PS5:
    https://guavaman.com/projects/rewired/docs/CustomControllers.html

    I have been approved and have only very recently received development tools. There is currently no ETA for official PS5 support. The release of Unity 2022 is causing me even more of a backlog of work because of the big changes they made now requiring all Net Standard 2.1 libraries.
     
    CChong_at_Infinity likes this.
  5. ChiliDog

    ChiliDog

    Joined:
    Oct 14, 2020
    Posts:
    4
    Thank you very much for your reply
     
  6. Roman-Ilyin

    Roman-Ilyin

    Joined:
    Oct 9, 2013
    Posts:
    29
    Hello. Can you please tell me if the version for 2021 will work with unity 2022.1?
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    It is definitely not designed to work with Unity 2022, nor could it ever be designed to work with a future version of a dependency (Unity) that wasn't out when it was built. I cannot guarantee it will work. I know people have used it, but there's no guarantee every code path in Rewired will be free of exceptions (missing methods, etc.). Rewired is made up of mostly DLLs, and those DLLs are compiled to specific Unity DLLs (UnityEngine.dll, UnityEditor.dll, UnityEngine.UI.dll, etc.) for each major Unity release. There is no way to guarantee a DLL compiled to an old version of Unity will continue working with a newer version of Unity where there may have been breaking API changes. They've also just changed all the engine DLLs to be compiled to Net Standard 2.1 instead of the .Net 3.5 they've been using all these years, so I have a big task ahead of me rebuilding all the Rewired projects across all platforms and plugins to use Net Standard 2.1.
     
    wedgiebee likes this.
  8. shifatkhan

    shifatkhan

    Joined:
    Mar 29, 2022
    Posts:
    2
    Hello, is it possible to differentiate Xbox One controller VS Xbox Series X controller on windows? I tried debugging and creating a new map but they both seem to appear as "Xbox One For Windows".
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
  10. Cambesa

    Cambesa

    Joined:
    Jun 6, 2011
    Posts:
    119
    I checked the debug information and whats happening is:
    Within a game with a corgi engine you can attach one controller, then attach another, then deattach the first one. The 2nd joystick will then be moved to the first player.
    But in a scene without corgi, you can attach one controller, attach another one, then deattach the first one and the 2nd joystick will stay assigned to the 2nd player instead of automatically reassign to player 1. Then if you switch scenes towards a corgi scene, it will still the the joystick on the 2n player.
     
  11. shifatkhan

    shifatkhan

    Joined:
    Mar 29, 2022
    Posts:
    2
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    It's not Windows. It's the HID descriptor's product name. Microsoft used the same product name on Xbox One and Xbox Series X controllers. They likely did this for compatibility with games that match by product name. But I don't work for Microsoft so I can't say for sure why they did it.

    As for Rewired's controller name reported by Joystick.name, that is not just copied from the HID descriptor. That is the name I chose to give the Controller Definition that the controller matches to based on the identifying information the controller provides. Both the Xbox One controller and the Series X controller match to the Xbox One Controller definition when Use XInput is disabled and therefore report that name. When Use XInput is enabled, nothing can be known about the controller but that it is a gamepad, hence the name XInput Gamepad. The hardware HID name can be seen at Joystick.hardwareName.
     
    Last edited: May 31, 2022
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    What you're describing re-enforces my suspicions above that you have two different Rewired Input Managers being used. The Rewired Corgi Engine integration contains no code that would re-assign Joysticks. (Unless you've integrated Control Mapper or something, but that's not part of the integration.) What you're describing is perfectly consistent with having two Rewired Input Manager instances in two scenes that are out of sync with each other, one with some kind of different setting that affects controller assignment. You've already said above that you use the method of putting Rewired Input Managers in every scene and letting Rewired delete the one in the scene when it loads. This is a very, very common source of inexplicable problems because you see one result when you run your game starting from the title screen (assuming that's where the first Rewired Input Manager lives) and another result when you start your game from within a level because one or the other prefab instance was edited and now has unintentional prefab overrides. Because this kept coming up over and over as the cause of problems, I created the Rewired Initializer so this could be avoided entirely.

    See the section "Using the Rewired Input Manager in your game":
    https://guavaman.com/projects/rewired/docs/InputManager.html

    Delete all Rewired Input Manager prefab instances in your scenes, create a Rewired Initializer prefab and link the Rewired Input Manager prefab to it, then drop an instance of the Rewired Initializer in every scene. There will be no more possibility of accidentally editing a Rewired Input Manager instance instead of the prefab and have settings to be out of sync between different scenes.
     
    Last edited: May 31, 2022
    Cambesa likes this.
  14. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    Hello, I added some actions for testing before. But when I deleted them and added the 'Skill3' action, I got an unexpected action id. X[L3QH5)JUR_WDBE4B]O1Q0.png
    82WISF1~X@@JE4G`OM8R[A6.png

    As you can see the skill3's action id is 16 now, which I expect is 5 after the skill2.

    Is there any method to reset the action Id?
     
  15. Cambesa

    Cambesa

    Joined:
    Jun 6, 2011
    Posts:
    119
    I'm using the Rewired Initializers method now but the same problem is still happening. In all scenes that have corgi engine it works perfectly, but in the scenes without corgi engine such as the main menu, the automatic re-assigning the 2nd joystick to the first slot does not work. I was expecting it has something to do with the RewiredCorgiEngineInputManager component but copying that one to others scenes does not change anything.

    Edit: Fixed the issue by placing a completely irrelevant gameobject in the hierarchy where the hot plugging did not work, still don't know why
     
    Last edited: May 31, 2022
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    In Rewired, an Id and index are different concepts:

    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.

    --------------

    There is no reason your id's should have to be sequential. They should never be used as if they're an index for iterating through lists.

    Because some people just can't stand having gaps in their ids for whatever reason, I had to make the "Compact Ids" functionality:

    https://guavaman.com/projects/rewired/docs/RewiredEditor.html#Tools

    Again, there is absolutely no functional reason for ids to have to be sequential. This is purely cosmetic.
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    What you're telling me is happening just should not be happening -- there is absolutely no way adding a GameObject anywhere would do anything at all to Rewired. Rewired has nothing to do with GameObjects or anything in your scene hierarchy except for the GameObject that contains the Rewired Input Manager component that just executes Awake, Update, etc. Rewired's code is entirely independent of the scene and never references anything in the scene. This is just coincidence it started working and probably because of what I explain below.

    I think something completely different is happening here than either of us think and it probably has to do with the specific controllers you're using and the input source(s) you're using for input.

    What are your settings for the Windows platform (assuming you're using Windows) in the Rewired Input Manager?

    I need to know:
    1. Primary Input Source
    2. Is Use XInput Enabled?
    3. Is Enhanced Device Support Enabled?
    4. Is Disable Native Input enabled?
    And I also need to know:
    1. What controllers are you using to test this?
    2. How are these controllers connected? (USB, Bluetooth, etc.)
    3. Is Steam running?
    My current suspicion is:
    • You are using Xbox Controllers and XInput is enabled.
    • When you are plugging in the controller the 2nd time, SOMETIMES XInput is assigning that controller a different id than it had before you unplugged it (on the old Xbox 360 controllers, this would appear as a light on the controller that shows 1-4. XInput can often randomly assign the same controller a different id when it is re-connected.)
    • Because the controller is being assigned a different id, Rewired is matching that controller back to Player 1 when plugged back in because the new id matches to what Player 1 used to own. Or, if it's a new id that neither Player owned before (ids 1-4 are used by XInput), it is being assigned to Player 1 because neither Player 1 or Player 2 have ever owned that id and therefore it just assigns it to the first player that needs a controller.
    • Apart from the XInput id, Rewired has absolutely no way of telling one controller from another after they've been disconnected. There is no unique identifier for controllers available through XInput.
    • This would explain the randomness you're telling me where something is happening differently in different scenes or after adding a Game Object. That would all simply be coincidence and it just so happens in the XInput id is changing sometimes but not always when you are re-plugging a controller.
    What is supposed to happen when a controller is plugged in if you've left the default Joystick Auto-Assignment settings and Reassign Joystick To Previous Owner is true is that when the joystick is plugged back in, it assigns it to whatever Player owned it last. This is exactly what is happening when the joystick gets re-assigned to Player 2 after you unplug and re-plug it.

    But it sounds to me like you want it to work differently. You want it to reassign that joystick to Player 1 instead of Player 2? If that's what you want, then you have to change the settings because the default settings do not do that, and it is only happening because of the artifact of XInput changing the XInput id on you (which is not something the software can control.) If you want it to always assign connected joysticks to the lowest Player id, disable "Reassign Joystick to Previous Owner" in the Joystick Auto-Assignment settings. This will make it it assign the joystick to the lowest numbered Player that does not currently have a joystick even if some other Player previously owned that joystick.

    If that doesn't answer this, then, if possible, I would like to edit your project and see for myself what is going on. If you can upload it somewhere where I can download it, send me a link in a PM.
     
    Last edited: May 31, 2022
  18. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    The compact ids is exactly what I want. thx !
     
  19. MarshyMadness67

    MarshyMadness67

    Joined:
    Mar 30, 2022
    Posts:
    3
    Hello, how do I go about making this work with rigidbody2d over the character controller. I see it's deprecated in the information but there's no collision detection the current way unless I'm doing something wrong. This is my first game and it's 2d top down
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Your question is about Unity's physics system. Rewired does not manage anything regarding collisions, physics, or any other game logic. Rewired simply provides input. What you do with that input is outside the scope of the input system. Moving an object in the scene is the same whether you're using Rewired, Unity's input system, or any other input system. I suggest you ask questions in the other Unity forums about Unity's physics system and how to move objects around.
     
  21. MarshyMadness67

    MarshyMadness67

    Joined:
    Mar 30, 2022
    Posts:
    3
    I'm Sorry if my question wasn't clear. When we use <CharacterController> and cc in the script provided as a tutorial it creates a character controller component on the game object. If I just replace these with rigidbody in the script should it work?
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Your question was very clear. My point was, your question is not about Rewired, but about how to deal with Unity's physics system. I don't provide support for Unity's physics system.

    The code you are referring to is in the Quick Start:
    https://guavaman.com/projects/rewired/docs/QuickStart.html

    "NOTE: This example is not meant for use in your project. It serves no purpose other than to teach you how to get input from a Player. You will have to write your own scripts to move your characters/objects around the scene."

    The only point of that code is to show you how to get input from Rewired, not how to move a character around in the scene. That code is not meant to be copied and pasted and used for any other purpose other than to see what the example does. The example code does not involve collisions with any other objects, so it sounds to me like you're trying to use that code as the basis for some character controller script in your game. That is the reason I included that quote above in the documentation -- to make it clear that is not the purpose of this code.

    CharacterController is not the same thing as a Rigidbody and they are not interchangeable. No, replacing the component with a Rigidbody will not make it work without additional code changes. Character Controller is a completely separate physics class Unity created for controlling characters. Rigidbody is a general purpose rigid physics object that reacts to physics forces. Applying a force to a Rigidbody is different than applying a force to a CharacterController.

    Again, I suggest you look for help in general Unity forums about how to move physics objects around. Rewired's only purpose is to provide the input. What you do with that input after that is up to you.

    Here is an article showing the difference between CharacterController and Rigidbody:
    https://medium.com/ironequal/unity-character-controller-vs-rigidbody-a1e243591483
     
  23. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    Hi, I wanted to report a small bug, which becomes pretty annoying if you have to perform this action quite a lot.

    We're in the process of building some custom tools regarding importing/exporting rewired's data to easily switch between project contexts. One of the actions we perform in this is the 'Compact Ids'. After that, the fields in the 'Export Constants' section all reset to their default. Is this considered a bug? Or was this perhaps done deliberately?

    Thanks!
     
  24. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    322
    Is there an estimate for the Unity 2022 version? I had to update to it now Rewired doesn't work anymore.
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    I am aware of this issue and have fixed it but I cannot release an update because I'm stuck between some very large changes I was working on for MacOS that aren't finished, Reworking PS4 support as a plugin, and now Unity's 2022 update which has become a major effort to try to get Rewired and all its plugins and addons working for Unity 2022 because everything has changed to Net Standard 2.1 by Unity. All configuration settings are being lost when you compact, including everything on the Settings page.
     
    LuGus-Jan likes this.
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    What isn't working? I've heard other people using Rewired with Unity 2022 even though it's not supported.

    I don't have an estimate for when I'll be done. Unity 2022 brought major changes, requiring all assemblies that link to UnityEngine.dll, UnityEditor.dll, UnityEngine.UI.dll, and any other Unity DLL be built to .Net Standard 2.1. All Rewired and plugin/addon projects (and there are a TON of them) have to be remade as .Net Standard 2.1 projects, and my whole build toolchain has to be compatible with Net Standard 2.1. Currently, the Rewired Input Manager editor code is crashing Unity and I don't know why. There a lot of things to work though before I can release an update.
     
  27. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    I see. Thanks for the head's up! :)
    I can imagine this being a difficult balancing act. Looking forward to the update.
     
  28. Avalin

    Avalin

    Joined:
    Oct 12, 2018
    Posts:
    98
    Hey, I'm having some issues with GetButtonUp, and I'm unsure if I have misunderstood how it is supposed to work. Here's my code:

    Code (CSharp):
    1.         private void ProcessInput()
    2.         {
    3.             var player = RewiredData.Player;
    4.             direction =
    5.                 new Vector2(
    6.                     player.GetAxis("Move Horizontal"),
    7.                     player.GetAxis("Move Vertical"))
    8.                     .normalized;
    9.          
    10.             MovePlayer(direction);
    11.         }

    Code (CSharp):
    1.         private void MovePlayer(Vector2 direction)
    2.         {
    3.             var player = RewiredData.Player;
    4.  
    5.             var newXPosition = playerObject.position.x + (direction.x * 0.32f);
    6.             var newYPosition = playerObject.position.y + (direction.y * 0.32f);
    7.          
    8.             if(player.GetButtonUp("Move Horizontal"))
    9.                 playerObject.position = new Vector2(newXPosition, playerObject.position.y);
    10.              
    11.             if(player.GetButtonUp("Move Vertical"))
    12.                 playerObject.position = new Vector2(playerObject.position.x, newYPosition);
    13.          
    14.             Debug.Log(playerObject.position);
    15.         }
    The problem is that the GetButtonUp only works for the positive axis. (Move Right, Move Up) When I attempt to press to Move Left, or Move Down nothing is registered. (Checked with a Debug.Log, it's simply never called)

    The documentation says this method should work for axis as well as buttons, so am I using it wrong somehow?
    I want my player to move only one step per button press, hence GetAxis isn't enough to achieve this elegantly.

    I'm on Unity 2021.3.3f1 if that has an impact.

    Edit: Obviously found the "player.GetNegativeButtonUp" right after, which solved the issue by expanding the if-case. Seems confusing that there's a GetNegativeButtonUp, and the corresponding GetPositiveButtonUp isn't named accordingly; I would have assumed GetButtonUp would work in both cases.
     
    Last edited: Jun 8, 2022
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    This is covered here:
    https://guavaman.com/projects/rewired/docs/HowTos.html#button-press-types

    The behavior of an Action's button events generated by an underlying axis value can be changed on the settings page:
    https://guavaman.com/projects/rewired/docs/RewiredEditor.html#Settings

    There would be no point in changing the names of the functions 8 years after I developed the API. And the API was designed to be extremely similar to Unity's API for easy drop in replacement of UnityEngine.Input.
     
    Last edited: Jun 9, 2022
    Avalin likes this.
  30. Lesha-VH

    Lesha-VH

    Joined:
    Jul 3, 2012
    Posts:
    96
    guavaman,

    1) I think asmdef(s) should be added to separate your solution. What do you think?

    My game inside separate assembly (defined using asmdef), but, for example, RewiredEventSystem is not visible (Auto Referenced set to true).

    3) May be loading time can be improved? It takes long))

    Thank you!

     

    Attached Files:

    Last edited: Jun 12, 2022
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    ASMDEF files cannot be included with Rewired or every project that does not use ASMDEF files will be broken. Asset store assets cannot require users make their entire projects use ASMDEF files. If you want to use them, you have to manage it:

    https://guavaman.com/projects/rewired/docs/HowTos.html#asmdef-files

    The error you are reporting is because you have the wrong version of Rewired installed for the version of Unity you are using.

    https://guavaman.com/projects/rewir...tml#installation-problems-and-compiler-errors
     
  32. Gaspedal

    Gaspedal

    Joined:
    Mar 29, 2009
    Posts:
    376
  33. sk1zZ

    sk1zZ

    Joined:
    Mar 30, 2015
    Posts:
    9
    Good day! I have a couple of problems that bothering me for a long time.
    1) I'm using RewiredStandaloneInputModule for my UI. I created a separate actions for my UI and put them in UI category in Actions section. In Joysticks Map i create Protected category, where Menu button already be, and link UiSubmit action to appropriate button on joysticks, also update link in RewiredStandaloneInputModule for Submit to UiSubmit.
    With xbox one controller i can rebind any action on Submit button (X) but when i did it UI stops to accept Submit action and UI broke.
    With PS4 controller i can't change any action to Submit button (Square) but players should have choice on which button they want to set game' action.
    Can you help with that? Is there any "right way" to set UI controls and remap functionality for joysticks (Xbox one and PS4)?

    2) After playtasting our game, some players noticed that Attack action in remap window is blank, but there must be LMB. It happened on game's start and i think it's impossible to remap action to blank. It's rare case but for some people it critical bug which prevent them to play game. I don't know they setup, maybe it's laptop problem, but i hope you had this problem before and know what is a cause of this problem.

    Thanks in advance!
     
    Last edited: Jun 17, 2022
  34. JacobDzwinel

    JacobDzwinel

    Joined:
    Dec 19, 2013
    Posts:
    26
    Hi guavaman,

    My game had the same problems with mouse input. Some users couldn't select or click any UI buttons with mouse (keyboard and controller worked fine). It was really hard to reproduce because on most computer everything worked fine. Fortunately I found this post above from LittleRockGames and setting "Allow Mouse Input if Touch Supported" field did a trick. I'm glad everything works fine now, but I just wanted to let you know. Thanks.
     
    Last edited: Jun 18, 2022
  35. jesiebieszczu

    jesiebieszczu

    Joined:
    May 29, 2021
    Posts:
    21
    Hi, I'm using integration for Corgi Engine (works like a charm, thanks :)), and trying to assign players on start button press, however the problem I'm facing is that they're all assigned on start(?) with the recommended corgi import already, hence I cannot reassign them - is there any setting I could use to have the players not be assigned on start, so I can assign them with a script instead?

    And if there isn't one - which script / in which place could I look for that assignment part to disable it on start, so I could use a start press script instead? (I guess another question would be if I can somehow uncasing all players via script, it would resolve my issue as well + give me an ability to have people opt out if they as well).

    Thanks in advance :)
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    What are you trying to do here? You say you've set the UI actions as a protected category, but then you say you want to remap them? Protected means you cannot remap them. That's the whole point of a protected category.

    If UI Actions are not responding after you're remapping a non-UI Action, then you have not set the UI map to protected. There is no possibility a UI map could be changed if it is a protected map category that is not conflict checked against your other maps.

    Use Debug Information to see exactly what is happening at runtime when you are modifying bindings:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information

    I don't even understand the problem. What do you mean by the "Attack action in remap window is blank, but there must be LMB"? Are you saying the default binding of Attack should be LMB but there is no default binding for these users?

    If your users are seeing different default bindings that you are, then you are probably testing with XML/JSON save data that has overwritten your Rewired Input Manager default values:
    https://guavaman.com/projects/rewired/docs/UserDataStore.html#saved-xml-not-synced

    Clear Player Prefs on your development system and open the same starting scene the users are using when you make a build and test it.

    Another possibility is that you are making a build with a different Rewired Input Manager than is in the scene you're testing. It is a VERY common cause of bugs when you place Rewired Input Managers in every scene and accidentally edit one of the prefab instances so its data is different from all the others. Then you test the game in the editor by opening a level and it works one way, but when you make a build you get a totally different result because the prefab instances are out of sync. Get rid of all prefab instances and use a Rewired Initializer:

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

    It is recommended you create a Rewired Initializer in each of your scenes. The Initializer will spawn the Rewired Input Manager as needed on Awake, but will not spawn multiple Rewired Input Managers when loading new scenes avoiding errors. This will allow you to use the same Rewired Input Manager in each scene and be able to test these scenes individually in the editor or load them during gameplay.

    Create a Rewired Initializer from the menu: Window -> Rewired -> Create -> Initializer
     
    Last edited: Jun 19, 2022
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    "Allow Mouse Input if Touch Supported" is enabled by default. It could only get disabled if you disabled it.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Joystick Auto-Assignment:
    https://guavaman.com/projects/rewired/docs/Controllers.html#joystick-auto-assignment

    Manually Assigning Controllers to Players:
    https://guavaman.com/projects/rewired/docs/HowTos.html#assigning-controllers
     
  40. Cramonky

    Cramonky

    Joined:
    Apr 1, 2013
    Posts:
    186
  41. MonstaManly

    MonstaManly

    Joined:
    Apr 18, 2020
    Posts:
    11
    Is this input system capable of detecting mouse position and saving it as a input (EX. when in a attack mode I want the mouse pointing upwards to return a "up" input and moving the mouse to the left to seamlessly return a "left" input) so that I may work on a Kingdom Come deliverance type of attack system.

    I use UCC btw, don't know if it matters.
     
  42. jesiebieszczu

    jesiebieszczu

    Joined:
    May 29, 2021
    Posts:
    21
    Thanks, making some progress with these, tho the problem I still have is getting the ID of controller that is being used at the time. Outside of already assigned players for corgi x rewired input the only thing that is giving me controller id is
    ReInput.controllers.polling.PollAllControllersOfTypeForFirstElementDown(ControllerType.Joystick), however it seems to sometimes trigger and sometimes not on regular keydown / it works at all times with corgi x rewired input manager, but that's when the characters are already assigned, so it's not really useful at that point.

    Is there any easy way to get controller id of the controller that is currently being pressed, if the controllers aren't assigned to the players?

    What I'm trying to do right now is to basically get the id of the currently used controller lets say on stat press and then assign it to the player, like so:
    AssignController(currentPlayer, info.controllerId)

    which is working with ControllerPollingInfo
    , but as mentioned not all the time unless it's going through corgi x rewired input manager (so while already assigned to a character).

    I'm of course aware that it says the controllers.polling should not be used in gameplay (character select menu in this case) but I wasn't able to find any other way to get controller id.
    ( public ControllerIdentifier identifier { get ; } seem to always return 0 for the ID, unless maybe I'm using it wrong...)

    Any help would be much appreciated, thanks.
     
    Last edited: Jun 19, 2022
  43. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    They are working for me. With Windows 10 and using FireFox v101.0.1 and I was able to download both files without any problem.

    What browser are you using? Have you tried clearing cookies and restarting the browser?
     
  44. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Not familiar with "Kingdom Come deliverance type of attack system".

    What is UCC? Is that Ultimate Character Controller?

    But you should try out what you want with the free trial version of Rewired before purchase.

    You can try the free trial here:

    https://guavaman.com/projects/rewired/trial.html
     
  45. Cramonky

    Cramonky

    Joined:
    Apr 1, 2013
    Posts:
    186
    I am using Chrome. Tried clearing browser data and restarting, as well as turning off my ad blocker, but still no luck. It works on Edge (after giving a "Can't be downloaded securely" warning.
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    There's a whole section of the documentation devoted to creating a "Press Start to Join" system with various different versions discussed and the caveats of each. I suggest you start here:

    https://guavaman.com/projects/rewired/docs/HowTos.html#press-start-to-join
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,609
    Generally, no. There is no functionality to make a mouse into an invisible on-screen joystick. That is something that would be built on top of the input system. There are many different styles that one might need for their specific purposes, such as -- is the center of this invisible joystick pinned to some location (center of screen) or is it always relative to the current mouse position? If pinned, what's the min, max range? This would require a very involved design similar to on-screen touch controls to provide all the possible features one might want. Based on my experience with the touch controls, there is no possible way to design a system that would provide everything everyone wants to do.

    The included touch controls are built on top of the Custom Controller system. You could do the same thing to create your "mouse joystick" control.

    https://guavaman.com/projects/rewired/docs/CustomControllers.html
     
  49. Q-Ted

    Q-Ted

    Joined:
    Dec 16, 2016
    Posts:
    46
    Hello,

    We have Rewired setup to only update on Update, however we are still seeing a 0.11 ms block in the profiler of Rewired doing something in FixedUpdate. Our game is at a stage where we are looking to optimize every little bit and we are wondering what Rewired is doing here? And would it be save to override the function in the InputManager?

    Stepping through visual studio's decompiled metadata only goes so far in getting to understand what actually happens in there.

    Cheers.

    P.S. It would be nice if a toggle could be added for disabling mouse polling like you can for keyboard. A lot of console games will never make use of the mouse outside of development. We currently just have the following bit of code to disable it for platforms that don't use it:
    Code (CSharp):
    1. Rewired.ReInput.controllers.Mouse.enabled = false;
     
  50. sk1zZ

    sk1zZ

    Joined:
    Mar 30, 2015
    Posts:
    9
    Thank you for the answer!
    1) Partly solved.
    I've disabled "Check Conflicts With All" and "Visible In List" for my UI actions, and remapping started working. Also for me, it was a surprise that Xbox one controller on PC detects as Xbox 360. Spend a lot of time to find why i was changing xbox one bindings and nothing happened. Maybe it mentioned somewhere, but i didn't see it, and it was pretty annoying.
    1.1) Last thing that still doesn't work in my UI is "UICancel" on RMB and "UiSubmit" on Enter keyboard's key and UI navigation on WASD.
    I set "Allow Mouse Input" and mouse is working like a charm, but Rewired's debug is saying that "UiCancel" action isn't pressed on RMB. On joystick, "UiCancel" is working without any problems. Same with "UiSubmit" on Enter key and WASD navigation. On joystick, it's working, but on keyboard don't. I've missed something in mouse/keyboard settings?
    2) I've put Initializer on my title scene and everything is working as before. I can't reproduce why someone has blank action where it should be LMB button, so for me is still a problem. I don't think Initializer will fix this because i had only 1 Rewired input prefab on title scene and change only it.
     
    Last edited: Jun 20, 2022