Rewired - Advanced Input for Unity

There is no such concept in Rewired as removing a Player, nor can you create a new Player from a script at runtime. All data in the Rewired Input Manager is static and can only be edited at development time, not runtime. Any data in runtime instances of objects (Players, Controller Maps, etc.) can be edited at runtime, but new Players cannot be created, nor can they be deleted. You need to create the maximum number of Players you will ever need, then use only those that are needed at runtime for input by managing which Players are assigned Controllers.

If you want to implement some kind of system where you only consider certain players that are currently playing, you have to implement that yourself. The Player.isPlaying property was provided for this purpose and is for developer use. Changing this value to false will not cause a Player’s input to no longer work. The only built-in functionality this flag changes is Joystick Auto-Assignment, and only if Assign to Playing Players Only is enabled. The primary purpose of this flag is for developer use so you can perform other custom functionality depending on whether or not a Player is playing.

The concept of a “playing Player” has a number of implications, including potentially on controller assignment, depending on how you choose to handle that. If you are using the Joystick Auto-Assignment system, it can be set to only assign Joysticks to currently playing Players.

As for keyboards, I do not know what you mean by “Keyboard players doesn’t connecting to the game”. You will have to provide more information about how you are handling these Players with regard to connection.

The Keyboard in Rewired is intended to be a shared Controller. Like Joysticks, only Players which have the Controller assigned to them will produce any input from keyboard input. There is no such thing as a Keyboard Auto-Assignment system in Rewired, therefore, you have to manage keyboard assignment to Players manually based on the needs of your game. Keyboard assignment can be configured per-Player in the Rewired Input Manager for assigning controllers on start, and it can be assigned to Players through scripting by settings player.controllers.hasKeyboard. In addition, like all controllers, the Player must also have Controller Maps for the Keyboard loaded that bind Actions to keyboard keys in order for keyboard input to work.

If your question is just asking “why doesn’t keyboard input work”, none of the pictures you posted show Keyboard Maps, whether those Keyboard Maps have been assigned to Players, or whether or not the Keyboard itself has been assigned to Players. See Troubleshooting - Keyboard doesn’t work.

1 Like

Hi everyone!
I have a glyph system associating a sprite to a specific ControllerElementIdentifier from a HardwareJoystickMap.

I’m trying to get this sprite in edit-mode but I can’t figure out how.

During playmode I usually get the ActionElementMap with player.controllers.maps.GetFirstElementMapWithAction(Controller, actionId).

Any help?

Thanks!

Hello! I was wondering if anyone has found any way to change some of the logic baked into the control remapper? My game is set up in such a way where player one and two have two different control schemes on the same keyboard, so local play is possible without controllers. However I’d like to include a way to remap controls just for accessibilities’ sake. Is there any way to change the currently selected action category based on the currently selected player at the same time the player selection is changed? For example I want player one, three, and four to use the default category, and player two to use its own separate category. As of right now to change player two’s control scheme they’d have to select player two, and then the “player two” action category. Im just hoping I can eliminate that last step to make things easier. Any ideas?

There is no way to know this information at edit time. Rewired is not even initialized, so ReInput is null. Rewired’s configuration is not project-wide. Everything in Rewired is dependent on a Rewired Input Manager, which contains all the data. Only one enabled Rewired Input Manager Game Object can be initialized will set itself as the source of ReInput. Only after initialization is this data available, and it cannot be accessed before initialization unless you want make a reference to the Rewired Input Manager you plan to use and then wade through the undocumented internal-use functions in the UserData class (the class that holds all the Rewired Input Manager config data) to find some Controller Map for a particular Controller. Some of these functions are internal as well.

What is the use case for needing these controller element glyphs at edit time? If Rewired is not running and controller is not connected, you wouldn’t know what controller will be used in most cases anyway.

First, to answer your question, there is no way to do what you are asking without you maintaining your own source-code copy of Control Mapper. I don’t provide support on helping you do this kind of change to Control Mapper as stated in the documentation:

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

But in reading your question, I don’t see any reason why you would need to have a separate Map Category for Player 2.

First, to clear up terminology, you are using the term “Action Category”, but an Action Category does not pertain to Controller Maps or bindings. It is simply a grouping of Actions for categorization purposes, and is only used (optionally) by Control Mapper to determine what list of Actions to show on the left side. There is no button that corresponds to changing an Action Category. Those across the top correspond to changing the (Controller) Map Category.

Based on what you have described of your game’s input needs, you should not be creating a separate Map Category for Player 2 in order to handle keyboard input. Instead, you should create a different Layout for each Player that needs to use the keyboard, as noted in the Layouts documentation.

Layouts could also be used as simply another categorization level. For example, for a shared controller such as the keyboard, it may be useful to have specific layouts for each player. Your Map Categories could be Default, System, Menu, Infantry, Vehicle, etc. to organize your maps by game mode, while your layouts could be System, Player0, Player1, Player2, etc., to further organize your maps by player.

This setup is also shown in some of the example scenes included with Rewired, including the Control Mapper demo scene.

Using Layouts, your problem simply goes away because Control Mapper will display the Controller Map in whatever Layout it finds loaded in the Player for a particular Map Category.

Thanks a ton! you’re super right yeah, I should’ve just done that. Apologies for the term misuse also, my bad.

What is the use case for needing these controller element glyphs at edit time? If Rewired is not running and controller is not connected, you wouldn’t know what controller will be used in most cases anyway.

I have a custom scriptable Glyphs Map - one for each mapped controller - that it’s used at runtime to get the proper sprite for each specified ControllerElementIdentifier:

At runtime I get the sprite starting from an actionID using:

ActionElementMap aem = ReInput.players.GetPlayer(0).controllers.maps.GetFirstElementMapWithAction(activeController, actionId, false)

and then I get the right scriptable Glyphs Map through activeController.hardwareTypeGuid. Finally I get the right entry thanks to the ActionElementMap.elementIndetifierName.

This logic is used for a custom component UIGlyph, which stores an actionID:

The Image.sprite is then updated at runtime depending on the last controller used.

Here what I’m trying to achieve:

when I set in the inspector the UIGlyph.ActionID I want to update the Image.sprite too, using an arbitrary Glyphs Map (in my case the one for XOne), instead to be forced to do it manually. So I need a way to get an ActionElementMap for the XboxOne controller, given a certain actionID.

Thanks for the info.

Unfortunately, this information is not available at edit time. The only way you could get it would be to use undocumented functions, probably requiring reflection to access some, to get the information from the serialized data in the Rewired Input Manager component. It wouldn’t be straightforward as you would be dealing with editor Controller Maps and Controller Template Maps meant for internal use, not the runtime versions. The Editor Controller Template map would not be translated into a Controller Map for the specific controller either, as it would be at runtime. In short, this is not supported.

Hi, not sure if I should ask here but the support page captcha has “ERROR for site owner: Invalid site key” atm so I cannot email my question there.

I was wondering if there are known issues with the xbox elite series 2 controllers not working wirelessly? (works fine when plugged, also it gets detected as an unknown controller but the map is all messed up atm)

I am using:
-raw input
-unity 2023.2.20f1
-rewired 1.1.57.2.U2023
-windows 10-11
-Issue seems to happen in windows builds only

Thank you

I think Google may have deprecated and shut down Recaptcha 2.0. I’ve disabled Recaptcha on every form on the site and tested that they’re working now. That would explain why this past week has been so relaxing for a change… >_<

Xbox Elite Series 2 has not been explicitly supported. It will work and be recognized without issue through XInput and (possibly) Windows Gaming Input on Windows. If XInput and WGI are disabled, it will not be recognized by Raw Input because I have not added any explicit matching information for that controller to the Raw Input Xbox controller definition. Further, if some elements are not working as the Unknown Controller, they will not be fixed by adding the device matching info to the controller definition. All a controller definition does is provide a mapping from the low level elements to Rewired Element Identifiers. Unknown Controller supports all low level elements from button 0-127, axis 0-31, and hat 0-15. If an element is not returning value through Unknown Controller, the HID input report is not returning value for these elements and it can’t be fixed. (That would indicate a driver issue, IMO.)

Xinput supports Xbox controllers universally, so the controller should just work using XInput. However, the definition on WGI does use the axis/button/hat count as part of the matching criteria, so if this controller reports a different number than the expected 6, 14, 0, it won’t be recognized based on the current definition on WGI.

1 Like

If the controller elements work when using Raw Input (possibly even with WGI enabled) and the problem is just that the controller isn’t being recognized, you may be able to add recognition to the Xbox One definition. Open Rewired/DevTools/JoystickElementIdentifier and get the identifying information from the controller (hardware identifier, button/axis/hat count) and post it here. Please do this both with and without WGI enabled. (Modify the Rewired Input Manager settings in the JoystickElementIdentifierScene to enable/disable WGI). I will look at the information and see whether the hardware identifier can simply be added or whether another variant needs to be created (I suspect the latter because I believe it reports a different number of axes / buttons).

Hi
I’m not a developer, but I found a “bug” with SteamPlay/Proton in Linux. I am a fan of car games, and I have recently purchased two games that use this asset for controller configuration:
-Extreme Rally Raid
-PISTA Motorsport
In both, using Proton, the brake pedal of my Logitech G29 is not detected and cannot be configured. This makes the games totally unplayable using this compatibility tool.

Extreme Rally Raid fortunately has a native version, which does detect the pedal correctly (although not the FFB).

According to Gamepad Tester (Hardware Tester) my steering wheel in Linux ( 046d-c24f-Logitech G29 Driving Force Racing Wheel ) has the brake on axis 3:
Axis 0: steering
Axis 1: Clutch
Axis 2: Throttle
Axis 3: Brake
Axis 4: digital left-right crosshead
Axis 5: digital up-down crossbrace

I don’t know if these data can be useful, but I am willing to send more if necessary.

The Linux driver for my steering wheel is this one and so far I haven’t had any problems with any game using it:

Any issues that are specific to Proton/Wine and not present on a Windows build running on Windows directly are not the responsibility of Rewired, nor can these issues even be fixed by Rewired. Rewired is simply a consumer of the input values provided by the input APIs in use. When running under Proton, Rewired knows nothing other than it is being run on Windows and therefore consumes input from the various Windows input APIs.

Rewired’s controller definitions are designed to map elements on a device for each input source they support (Raw Input on Windows for example.) There is no capability of detecting Proton or supporting Proton-specific device mappings for Raw Input, Direct Input, XInput, Windows Gaming Input, or any of the other input sources supported.

Valve is the developer of Proton, so if there are any inconsistencies between Windows and Proton, they would have to fix the issue in Proton.

The Rewired controller definition for the Logitech G29 maps the “Brake” axis to “Rotation Z” on Raw Input and Direct Input. If no value is returned for this axis, then Proton is not sending any value for the Rotation Z axis in the HID input report.

Windows Gaming Input worked, thank you.

Hello there
small question, and sorry if i missed its answer, the new forums are weird and hard to search sorry.

But is there a way in rewired, where i can find out the type of controller that is connected in code?

example if player connects an XBox controller, is there a way i can find out if its an xbox controller or if its a PS controller, and so on?

its so that, i can show UI Hints for the player, based on the controller type automatically.

Also, minor question, how is steam deck’s support.

thanks.

I suggest you search the documentation for answers rather than the forum.

Displaying glyphs for UI hints:
https://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action

Identifying recognized Joysticks:
https://guavaman.com/projects/rewired/docs/HowTos.html#identifying-recognized-controllers

All things Steam-related:
https://guavaman.com/projects/rewired/docs/Troubleshooting.html#steam

Steam Deck is no different than any other Steam controller or Steam-configured virtual controller. Rewired does not use the Steam API, therefore it can only see devices as exposed through the OS input APIs. Steam exposes all Steam-configured devices in the same way through OS input APIs. This means the extra buttons on the Steam deck beyond the base elements (based on an Xbox controller) are not supported.