Search Unity

Rewired - Advanced Input for Unity

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

  1. HashbangGames

    HashbangGames

    Joined:
    May 7, 2011
    Posts:
    40
    I'll give some of those a whirl, I just did another test, and I don't think this has anything to do with the virtual joystick! It's a multi touch issue. I can press anywhere on the screen with my left hand and tap the Jump button and it shoots and jumps at the same time.

    Are there multi-touch settings somewhere?
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No. There are no known issues with multi touch. Try the example scenes. They do not exhibit the behavior you are describing. You have to have something in your setup causing this. Are you using Touch Regions?
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    This sounds to me more like something entirely different is happening than what you think. It's probably Unity's mouse simulation causing this. See this:
    https://docs.unity3d.com/ScriptReference/Input-simulateMouseWithTouches.html

    Unity creates an invisible mouse pointer. The first touch on the screen moves the invisible mouse pointer to a position and triggers a left click. Wherever the first touch was, the pointer still remains while you touch around with other fingers (I think). I don't know if multi-touches trigger the left click on the mouse (or perhaps a right-click), but it sounds like that's exactly what it's doing. It's perfectly consistent with your description of inconsistent behavior. The first time you tested, it was involving the joystick. Now it's not. You probably pressed on the button first moving the pointer there, then your other mutli-touches triggered both the mouse press and the touch press, causing it to send clicks to both the button and the other control. However, these mouse clicks should be ignored by the RewiredStandaloneInputModule and not sent to the UI elements because, like the StandaloneInputModule, it prioritizes touch input over mouse input. What version of Rewired is this?

    If you have Mouse maps mapping any of these Actions, that's another possible vector. Use this to verify:
    https://guavaman.com/projects/rewired/docs/HowTos.html#get-contributing-input-sources

    Or watch the mouse button values using the Debug Information prefab:
    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information

    Rewired's TouchController has an option in the inspector that disables Rewired's mouse input when enabled fir this reason.

    You did not say what platform you are testing on, but all mobile platforms use UnityEngine.Input for mouse input and will be affected by Unity's mouse simulation.
     
    Last edited: Oct 4, 2019
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No, there is no way to get that information.
     
    Xarbrough likes this.
  5. whatnotory

    whatnotory

    Joined:
    Sep 21, 2017
    Posts:
    7
    Question about the non-allocating GetElementMapsWithAction method -- why is there sometimes a disparity between the number returned by the method and the Count of the list?

    Simple partial-example that exhibits this behavior for me:
    Code (CSharp):
    1. playerToGetMapFrom.controllers.AddController(aController, true);
    2. ControllerMap aControllerMap = playerToGetMapFrom.controllers.maps.GetMap(aController, _mapCategory, 0);
    3. var actionElementMaps = new List<ActionElementMap>();
    4. int numElementMaps = aControllerMap.GetElementMapsWithAction(_actionString, actionElementMaps);
    5. Debug.Log("    numElementMaps: " + numElementMaps + "    listCount: " + actionElementMaps.Count);
    When aController is of type Joystick, it logs:
    numElementMaps: 1 listCount: 0

    However when aController is of type Keyboard, it correctly logs:
    numElementMaps: 1 listCount: 1

    Alternatively, using the array-allocating version of GetElementMapsWithAction seems to always work for me.

    Unity version #: 2017.4.30f1
    Rewired version # 1.1.27.3.U2017

    Thanks,
    --Ross
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Bug in override of method in ControllerMapWithAxes. It's not returning the button maps because the list is being cleared before getting the axis maps. KeyboardMap is type ControllerMap and has no axis maps and no method overloads.
     
    Last edited: Oct 8, 2019
    whatnotory likes this.
  7. HashbangGames

    HashbangGames

    Joined:
    May 7, 2011
    Posts:
    40
    Thanks! I'll look into this, it gives me a direction at least. Sorry for the delayed response. I've been sick for the past few days and have not been able to work on the project much.
     
  8. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    I'm working on a grid-based game. At the moment I enjoy using Rewired's GetButtonRepeating function to move units on the grid. There are actions for up, right, down, left movement and my gamepad's stick axis are converted nicely to these four directions and then used with GetButtonRepeating. However, now I would like to implement diagonal movement (8 directions) and wonder what the best approach would be since I would like to keep using the builtin repeatDelay provided via GetButtonRepeating.

    When I create 8 actions in total, one for each direction, then I can't configure Rewired to map joystick axis input to the correct actions or am I missing something? If I instead use only two axis for MoveHorizontal and MoveVertical and then use GetAxis2D to handle the direction myself, I don't benefit from the builtin repeatDelay.

    I guess it's very much possible for me handle the direction as a Vector2 and then do the repeatDelay in my game code, but I thought, maybe I'm simply not seeing how to set this up in Rewired, where its already builtin. Any ideas?
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    GetButtonRepeating applies to Actions queried as buttons. An Action consists of one underlying floating point value. Actions can only be bound to buttons (boolean values) or axes (floating point values). An Action cannot be bound to 2 axis values which is exactly what would have to happen to achieve what you are trying to achieve. You cannot bind the corner direction of 2 axes to a single Action. This would be akin to compound Action that simulates a physical 2D controller element like a D-Pad. Nothing like this exists in Rewired. All of the functions in Player for getting input values work on a single Action with the exception for a couple of simple convenience functions like GetAxis2D which does nothing more than call GetAxis on two different Action values in the Player and combines the results. None of the GetButton functions with all of their convenient state tracking, time tracking, repeat settings, etc. will work across multiple Actions. Rewired's core structure does not fit what you are trying to do. You will have to implement repeating yourself outside of Rewired.
     
    Last edited: Oct 10, 2019
    Xarbrough likes this.
  10. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Hey, I know you don't support pre-release Unity versions but since I can't see it mentioned in this thread, I thought you might want a headsup that:

    In Unity 2019.3.0b6 Touch controls are producing some ... odd compilation error behaviour for me (at least on Android).

    I upgraded my project from 2019.2.8 to 2019.3.0b6 and (after usual fiddling getting things sorted) everything works. When I instruct to build though, I get a bunch of errors from Rewired complaining about TouchInteratable serialization (attached). I figured it was out-of-date serialization info so went into the Canvas.prefab, flicked a setting off, serialized, flicked it back on, reserialized and retried build. Worked!

    The problem: Then the next time I tried a build I got the same error!?

    Not a huge pain but figured useful for you to know since after a while, it can be a bit annoying.
    HTH

    Full error log attached but for searchers, I'll paste a couple of relevant bits:

    Type '[Rewired_Core]Rewired.ComponentControls.Effects.TouchInteractableTransitioner' has an extra field '_transitionColorTint' of type 'UnityEngine.UI.ColorBlock' in the player and thus can't be serialized (expected '_syncFadeDurationWithTransitionEvent' of type 'System.Boolean')

    ...

    Fields serialized in target platform, class 'Rewired.ComponentControls.TouchInteractable'
    '_interactable' of type 'System.Boolean'
    '_visible' of type 'System.Boolean'
    '_hideWhenIdle' of type 'System.Boolean'
    '_allowedMouseButtons' of type 'Rewired.ComponentControls.TouchInteractable+MouseButtonFlags'
    '_transitionType' of type 'Rewired.ComponentControls.TouchInteractable+TransitionTypeFlags'
    '_transitionColorTint' of type 'UnityEngine.UI.ColorBlock'
    '_transitionSpriteState' of type 'UnityEngine.UI.SpriteState'
    '_transitionAnimationTriggers' of type 'UnityEngine.UI.AnimationTriggers'
    '_targetGraphic' of type 'UnityEngine.UI.Graphic'
    '_onInteractionStateTransition' of type 'Rewired.ComponentControls.TouchInteractable+InteractionStateTransitionEventHandler'
    '_onVisibilityChanged' of type 'Rewired.ComponentControls.TouchInteractable+VisibilityChangedEventHandler'
    '_onInteractionStateChangedToNormal' of type 'UnityEngine.Events.UnityEvent'
    '_onInteractionStateChangedToHighlighted' of type 'UnityEngine.Events.UnityEvent'
    '_onInteractionStateChangedToPressed' of type 'UnityEngine.Events.UnityEvent'
    '_onInteractionStateChangedToDisabled' of type 'UnityEngine.Events.UnityEvent'
     

    Attached Files:

  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    This is a known issue. This is Unity's issue and they must fix it. This is another issue related to their change to the Unity UI system moving it to the package manager just like this one:
    https://guavaman.com/projects/rewired/docs/KnownIssues.html#assembly-errors-2019-3-alpha-beta

    It's in the bug tracker too:
    https://issuetracker.unity3d.com/is...-fails-when-rewired-is-present-in-the-project

    I have decided to not track specific Unity beta version bugs in my documentation because I do not want to be updating it all the time with the latest issues caused by changes in pre-release versions of Unity. I will be removing the current one and leave the statement that alpha/beta versions of Unity are not supported.
     
    Last edited: Oct 12, 2019
    Arkade likes this.
  12. SixThreeZero_Lou

    SixThreeZero_Lou

    Joined:
    Oct 4, 2018
    Posts:
    6
    Is there any way to bind to shift+leftClick in Rewired?

    I don't see a one, and it seems unlikely since Rewired treats the mouse and the keyboard so entirely separately...

    On the other hand, Rewired is a pretty comprehensive package, and shift-click is a pretty common control, so it really seems like something that should be possible...

    I could bind shift to a second action, and then check if the shift action is held while the left click action is pressed, but that's not a good solution at all. Doing that makes it complicated and unintuitive to change the control, it will always have to be a two-key combination, etc. Plus, it just seems bad to use two actions for something that's definitely a single action. So that is one solution I would like to avoid.

    Thanks for your help!
     
  13. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Yeah saw the first, missed the last. Will look forward to their fixing.
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Rewired is designed differently than any other input system before it. A Controller Map binds Actions to elements on one Controller. Each Controller Map belongs to a single Controller. Keyboard and Mouse are separate Controllers, therefore a Keyboard Map is separate from a Mouse Map making it is impossible to bind an Action to multiple elements on two separate Controllers.

    How Controller Maps work:
    https://guavaman.com/projects/rewired/docs/ControllerMaps.html

    Multi-button Combos:
    https://guavaman.com/projects/rewired/docs/HowTos.html#button-combos
     
  15. SixThreeZero_Lou

    SixThreeZero_Lou

    Joined:
    Oct 4, 2018
    Posts:
    6
    Oh well. Guess I have to find a new input system for my game. That's a shame, I was starting to like this one.

    I don't suppose there's any plans to add more support for button combos in the future?

    EDIT: I think I found another keybind I can live with, in this case. That's still a gigantic limitation, though -- sometimes you really need a button combo, and handling it as two different actions and hard-linking them through code like the docs suggest is really not a good way to do that...
     
    Last edited: Oct 13, 2019
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Thanks for your opinion. Rewired is very up-front about its features and offers a free trial for everyone to try before they buy. If you want a refund, contact the Unity Asset Store.

    I will not be changing Rewired's fundamental structure and rewriting the entire system so you can bind key + left mouse click as a single Action.
     
    Last edited: Oct 13, 2019
  17. mr-bulldops

    mr-bulldops

    Joined:
    Dec 2, 2016
    Posts:
    23
    Hello,

    I was wondering if you had any suggestions on how I might only apply the calibration settings to a specific joystick map (eg- only apply to gameplay)

    We hide our mouse cursor when we detect input on a controller. We had a scenario where a user accidentally set an extreme zero setting which caused the neutral stick to constantly trigger hiding the mouse cursor. Soudns like each controller has a single map, so I woudl have to do something myself. to handle this but wanted to see if you had any suggestions / if others have done this in the past

    Furthermore, the Restore Defaults button doesn't seem to clear calibration maps. Is there an easy way to accomplish this w/o the controller plugged in
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Hiding the pointer when any input is detected on a Joystick and not turning it back on after the Joystick is no longer the active device anymore (unplugged) is dangerous. There's no way you can know if some device may be attached that is poorly calibrated (hardware) or even starts with some axis or button that is always on (triggers on unrecognized controllers that default to -1.).

    I'm going to have to guess based your information::
    1. You are using Control Mapper?
    2. You are using UserDataStore_PlayerPrefs?

    No, Restore Defaults in Control Mapper will not clear Calibration settings.

    How you're saving data ultimately determines how you clear your saved data. If you're using UserDataStore_PlayerPrefs, you have to clear PlayerPrefs.

    If on PC, the user can change their calibration settings using the mouse or keyboard.

    Changing the value through code, there is no way other than to write code to detect the joystick in question and clear the calibration values manually:
    https://guavaman.com/projects/rewired/docs/api-reference/html/M_Rewired_CalibrationMap_Reset.htm
     
    Last edited: Oct 15, 2019
  19. mr-bulldops

    mr-bulldops

    Joined:
    Dec 2, 2016
    Posts:
    23
    We do re-enable the mouse pointer once the controller is unplugged. but if the controller calibration can only be done with the controller plugged in we hit some issues.

    Sounds like we'll have to revisit a solution to this. Thanks for your reply
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Change it so you switch the visibility when the last active controller is a joystick and re-enable it when it's mouse or keyboard:
    https://guavaman.com/projects/rewired/docs/HowTos.html#last-used-controller

    The pointer will re-appear while they're moving their pointer around and disappear when they use the controller again. Last Active Controller checks for change in value, not current value, specifically for dealing with always-on buttons and uncalibrated Joysticks.
     
    Last edited: Oct 15, 2019
  21. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    talking about that, is there a way to disable/enable controllers at will?
    I'm interested on turning off keyboard input when someone is typing on a textfield, and then reenable that keyboard when it's out of the textfield. Otherwise if for instance the key B means, drop bomb... when someone is typing on a textfield and enters 'b' it will drop a bomb. I want to avoid that.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    There are many ways to flow control input.

    1. Set a variable in a script and check it before processing input. This is something every single game should be doing in my opinion. You don't just process all input, all the time, and turn off input when you don't want it processed. You check whether you're allowed to process input first. This should be part of a bigger permission system that determines whether the action is allowed. Set a flag in the permission manager when you enter a text field and check that flag along with all other criteria when determining if input is allowed (is game paused? does some UI panel have focus? is a cinematic running?). Before any script processes input, it checks whether it is allowed at the current time. This is the best way to handle this and many, many other situations. You do not need to disable parts of the input system to do it.
    2. Enable/disable Controller Maps.
    3. Enable/disable Action Element Maps.
    3. Assign/unassign Controllers to/from Players.
    4. Enable/disable Controllers.
     
    Last edited: Oct 29, 2019
  23. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Well, it's not that simple. Because I want to continue getting input from the joystick, just not the keyboard. Because WASD means up,left,down right. If I have it on a textfield when typing, i'll get my character moving in all directions. If I disable input, then I can't move my character with a joystick while typing.

    What I could do is create 2 mappings, one for keys and one for joystick, so one is left-keyboard and another left-joystick but then I have to begin adding if/else all over and checking twice for input instead of a simple getinput(up)
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Three options:

    1. Disable all Keyboard Maps in the Player.
    2. Unassign Keyboard from Player.
    3. Disable the Keyboard controller.
     
  25. daven8989

    daven8989

    Joined:
    Jan 25, 2014
    Posts:
    29
    Hello guavaman, I'm making the porting for PS4 of my game. It's all working great as always, but I'm noticing this strange behaviour. Basically the Touch module of PS4 controller it seems to be mapped as my right stick (it's change the rotation of the camera, it is a classic First Person game, Left stick move the player, Right stick move the camera rotation). I'm using the Gamepad Template and I double checked all the elements. I haven't added any element mapped to the touch module. This behaviour is only on the build ps4. If I run the game (with PS4 as target mode) from the editor, using a ps4 controler, the touch module simply doesn't do anything (that is the expected behaviour). Do you think I'm missing some configuration on rewired side?
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No it's not. It's the touchpad being mapped as a mouse by Unity. This is not Rewired doing this. This is the only setting I know of that may affect it:
    https://docs.unity3d.com/ScriptReference/Input-simulateMouseWithTouches.html
     
  27. daven8989

    daven8989

    Joined:
    Jan 25, 2014
    Posts:
    29
    guavaman likes this.
  28. jtannert17

    jtannert17

    Joined:
    Jun 1, 2017
    Posts:
    8
    Hi again,

    Upgrading to 2019.3.0b7 and trying to make a player build for Nintendo Switch we get the following compilation errors:

    Type '[Rewired_Core]Rewired.ComponentControls.Effects.TouchInteractableTransitioner' has an extra field '_transitionColorTint' of type 'UnityEngine.UI.ColorBlock' in the player and thus can't be serialized (expected '_syncFadeDurationWithTransitionEvent' of type 'System.Boolean')
    UnityEditor.BuildPipeline:BuildPlayer(EditorBuildSettingsScene[], String, BuildTarget, BuildOptions)

    Type '[Rewired_Core]Rewired.ComponentControls.Effects.TouchInteractableTransitioner' has an extra field '_transitionSpriteState' of type 'UnityEngine.UI.SpriteState' in the player and thus can't be serialized (expected '_syncFadeDurationWithTransitionEvent' of type 'System.Boolean')
    UnityEditor.BuildPipeline:BuildPlayer(EditorBuildSettingsScene[], String, BuildTarget, BuildOptions)

    Type '[Rewired_Core]Rewired.ComponentControls.Effects.TouchInteractableTransitioner' has an extra field '_transitionAnimationTriggers' of type 'UnityEngine.UI.AnimationTriggers' in the player and thus can't be serialized (expected '_syncFadeDurationWithTransitionEvent' of type 'System.Boolean')
    UnityEditor.BuildPipeline:BuildPlayer(EditorBuildSettingsScene[], String, BuildTarget, BuildOptions)

    Type '[Rewired_Core]Rewired.ComponentControls.Effects.TouchInteractableTransitioner' has an extra field '_targetGraphic' of type 'UnityEngine.UI.Graphic' in the player and thus can't be serialized (expected '_syncFadeDurationWithTransitionEvent' of type 'System.Boolean')
    UnityEditor.BuildPipeline:BuildPlayer(EditorBuildSettingsScene[], String, BuildTarget, BuildOptions)


    Is this a known issue or fixed in a later version? We are using Rewired 1.1.26.0.U2019.
    Note these compile errors are not present in the Editor.

    Cheers,
    Jack Tanner.
     
  29. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    From the Rewired documentation Unity alpha/beta/preview are not supported.

    https://guavaman.com/projects/rewir...ng.html#unity-alpha-beta-preview-experimental
     
    guavaman likes this.
  30. jtannert17

    jtannert17

    Joined:
    Jun 1, 2017
    Posts:
    8
    Well that doesn't change the fact that this will need fixing in a few weeks when Unity 2019.3 comes out of beta. My question was to see if @guavaman is aware of the issue and may be able to give us an idea what we could fix now. From what I can see there is a issue here with including the UnityEngine.UI assembly that hasn't been resolved in Unity 2019.2 and now results in a compile error in Unity 2019.3.
     
  31. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Since you were building for Nintendo Switch platform I thought that was supported via the Nintendo Developer Portal? Since I am not a switch developer I do not know what Rewired version is on the Nintendo Portal..

    The version of Rewired on the asset store is 1.1.28.0 which is newer than your version of Rewired which is 1.1.26.0. Did you try upgrading to the latest version of Rewired?

    I expect you have already read Rewired documentation with regards to Unity 2019.2 issue ..

    https://guavaman.com/projects/rewired/docs/KnownIssues.html#assembly-errors-2019-2

    and there are several more posts by guavaman in this UI thread starting at this post.

    https://forum.unity.com/threads/ui.673504/page-2#post-4807640
     
    Last edited: Oct 21, 2019
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    This isn't a Switch issue. It happens on all platforms as far as I know. It may be intermittent and sometimes work. It's a Unity 2019.3 issue. It is already known:
    https://issuetracker.unity3d.com/is...-fails-when-rewired-is-present-in-the-project

    This does not just affect Rewired. It affects many assets that use Unity UI. This is all due to their change to move Unity UI into the package manager. The specific "TouchInteractableTransitioner" error is a Rewired class, but the error is that Unity's ColorBlock is not being serialized correctly in that class.
     
    Last edited: Oct 21, 2019
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Switch support should be handled through the Rewired support form due to NDA restrictions:
    http://guavaman.com/rewired#support
     
  34. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Yeah this is a bug know to unity for months already. (I’ve reported it I forgot when, and they just keep releasing betas without fixing it). 2020.1alpha does not have this issue.
     
  35. jtannert17

    jtannert17

    Joined:
    Jun 1, 2017
    Posts:
    8
    Great news, thanks @guavaman I will keep track of that bug.
     
  36. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    Does rewired automatically know what controller is being used? For example, can I publish a game to multiple platforms and it would be able to figure out how to handle the input automatically? Do I have to do a lot of setup to support each platform?
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    There is no system that can automatically make input work.

    You have to set up Players, Actions, and Controller Maps for all the Controllers and Controller Templates you want to support. If a Controller is recognized on the particular platform using the chose input API(s), it will load the mappings you created for that Controller or Controller Template. Otherwise it will be an Unknown Controller and will have to be mapped at runtime.

    Each platform and/or device may or may not have special features available. Nintendo Switch has features that are not available on any other platform for example. If you want to use these special features, you must write code to use them.

    This answer to this question is too complicated to explain here. Please read the documentation to understand how Rewired works:
    https://guavaman.com/projects/rewired/docs/

    Download the free trial:
    http://guavaman.com/rewired/trial
     
    Last edited: Oct 24, 2019
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Rewired 1.1.29.0 is available on the Unity Asset Store.

    Please see Updating Rewired before updating.

    1.1.29.0:

    Changes:
    - Rewired Standalone Input Module: Added Deselect If Background Clicked inspector option.
    - Rewired Standalone Input Module: Added Deselect Before Selecting inspector option.
    - Windows Standalone, XInput: Moved vibration to separate thread from input to eliminate input lag when sending vibration to a problem XInput device.
    - PlayStation 4: Added Aim Controller support.

    API Changes:
    - Added RewiredStandaloneInputModule.deselectIfBackgroundClicked property.
    - Added RewiredStandaloneInputModule.deselectBeforeSelecting property.
    - Added Rewired.Platforms.PS4.Ps4AimExtension class.
    - Added Rewired.Platforms.PS4.PS4AimMotorType enum.

    Controller Definitions:
    - Added Sony PS4 Aim Controller.

    Bug Fixes:
    - ControllerMapWithAxes.GetElementMapsWithAction: Fixed bug causing button maps to not be returned in List<ActionElementMap> results method overloads.
     
    SugoiDev and Bartolomeus755 like this.
  39. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    With Rewired, if the game is played on mobile, will it automatically bring up mobile controls? If the game is played on XBox, it would not display the mobile controls?
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No. Rewired does not automatically do anything with mobile controls. You are responsible for setting up mobile controls if you want to use them. You can use the tools provided in the Touch Controls pack in Rewired or you can implement your own. How and when they are displayed is entirely up to you to determine.
     
  41. LumoKvin

    LumoKvin

    Joined:
    Sep 28, 2019
    Posts:
    195
    Capture.PNG

    I am using Ootii's Motion Controller. In 2016, you created a prefab and an Input Source file for integration. Are you able to have a quick look at these files and make sure they are still relevant?

    "Rewired is not just another Unity input wrapper like other packages."

    Is this statement invalid because the Rewired Input Source (mentioned above) is a Unity input wrapper?

    I will probably buy Rewired tomorrow or the day after, if everything goes smoothly with the free trial. Are there any other issues that I should be aware of when integrating with the Motion Controller?
     
    Last edited: Oct 28, 2019
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Please see the documentation on this integration:
    https://guavaman.com/projects/rewired/docs/Integration.html#MotionController

    Note: This integration is a 3rd party integration package and not maintained or supported by Guavaman Enterprises.

    I do not provide support for 3rd party integrations. Furthermore, there is no reason to believe these files are no longer relevant. Have you tried using it?

    Absolutely not. Look at all the native input implementations Rewired offers. This is far more than a Unity input wrapper. It can wrap Unity input optionally on all platforms and always on some.

    RewiredNativeLibs.gif
     
  43. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Hi @guavaman

    I have a question. How can I differentiate between my xbox controller and keyboard input?

    Code (CSharp):
    1. Void Start()
    2. {
    3.         player = ReInput.players.GetPlayer(0);
    4. }
    Code (CSharp):
    1. player.GetAxisRaw("LVertical")
    Code (CSharp):
    1. player.GetAxis("LVertical")
    "LVertical" seems to get recognized by Unity as both the Xbox controller and Keyboard.. What am I doing wrong? :(

    Thanks
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Controller Maps.

    Rewired is not going to make the keyboard automatically do something by itself. The only way the keyboard could be making any input happen in your Player is if you set up a Keyboard Map, bound Actions to keys, and assigned that to the Player.
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Rewired 1.1.29.1 is available on the Unity Asset Store.

    See Updating Rewired before updating.

    Release Notes:

    1.1.29.1:

    Changes:
    - Android Platforms: Added native workaround to handle keymapped and non-keymapped Sony DualShock 4 controllers (Unity 5+).
    - Android: Added keymapped and non-keymapped Sony DualShock 4 controller definition variants.
    - Amazon Fire TV: Added keymapped and non-keymapped Sony DualShock 4 controller definition variants.
     
  46. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Thanks for the link.

    Yea I also used "LVertical" for the keyboard mapping. Should I be using a different Action name for the keyboard mapping?

    Also should I be deleting all the Input values from Unity's Input Manager?

    Basically what I'm trying to do is: have Unity detect when the keyboard or the Xbox controller was used, then accordingly do stuff. Currently Unity is getting confused and thinks both control methods are being used simultaneously.
     

    Attached Files:

  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Not unless you have specific reasons for doing so. There's no benefit in doing that.

    You are telling it to do exactly that. That is how the system works. If you assign the same Action to multiple controllers or multiple buttons on a controller, it's going to respond to all of them. This is intentional -- it makes Rewired controller type agnostic. You just call GetButton and you get the Action's value, not the controller's value. This is the entire purpose of the Player-Action system in Rewired. If the user wants to use the keyboard, he can use it. If he wants to use a gamepad, he can use it. Your code doesn't have to know the difference 95% of the time.

    Look at the How To's page:
    https://guavaman.com/projects/rewired/docs/HowTos.html#last-used-controller
    https://guavaman.com/projects/rewired/docs/HowTos.html#get-contributing-input-sources

    Your Input Manager entries are not going to interfere with Rewired in any way. Delete them if you want. Do not delete the ones Rewired created.
     
    SugoiDev likes this.
  48. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    oooooooh. Ok I think I get it. I thought I had to use "Input.getkey" for Keyboard actions and "player" for rewired actions, so if I understand it correctly, I can delete all the "Input.getkey" from my code right?

    Thanks for the links. I gotta try out the "getlastactive" functions. That looks like the thing to solve my situation.



    Ok got it. I'll nuke everything thats not labeled "JoyAxis"

    Thanks again!
     

    Attached Files:

  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Yes. I think you should review the Rewired basics in the documentation:
    https://guavaman.com/projects/rewired/docs/QuickStart.html

    And all the sections under Concepts, especially Actions, Players, and Controller Maps:
    And the examples like this one:
    https://guavaman.com/projects/rewired/docs/Examples.html#eight-players

    If all you want is to know what kind of controller was last used in order to display glyphs or something, that's one option. Reading the sources of the Action can also be used for this purpose.

    Rewired also makes entries for the mouse.
     
  50. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Got it! Thanks!