Search Unity

Rewired - Advanced Input for Unity

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

  1. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,191
    Just to be clear, I am not trying to map a UI Submit Action to the left mouse button, but instead to an in game action (a weapon attack in a 2D game).

    You answered my question though; I thought there may be a small chance that because the left mouse button is integral to UI activation, there may be some built in support for allowing left mouse clicks to be ignored when the pointer is over a UI element. The fact that there's not is no biggie, but I just wanted to make sure!

    Thanks again!

    Edit: Per your advice I am trying to access the mouse map. I only have a single one, so I am using this bit of code (Player is correctly set to the player via ReInput.players.GetPlayer()):

    Code (CSharp):
    1. MouseMap mouseMap = Player.controllers.maps.GetMap<MouseMap>(0, 0);
    However, this is returning null. Am I doing something wrong? Thanks.
     
    Last edited: Apr 9, 2016
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    That's what I expected. What I was trying to get at (but poorly) is that all of Unity's UI system or other plugins you might make use of will be using a hard-coded check for left-click when doing things UI and mouse related. This includes the new UI and the legacy OnGUI, probably nGUI and others. Clicking over text fields, buttons, close boxes, and more will all be tied to mouse left-click and it is not remappable by the user, so that won't be an issue. Only Rewired Actions will be remappable by the user. If an Action such as Attack is mapped to left-click, this shouldn't cause any issue when using the UI unless the UI is visible and clickable during active gameplay. If this is the case, you will have to ignore the Attack Action in your code when the pointer is over UI elements. For most games, this would not be an issue because you would most likely be switching game modes before the UI was displayed such as when pausing the game, during dialog, etc., and ignoring all in-game Actions.

    You are using the wrong overload of GetMap<T>

    public T GetMap<T>(int controllerId, int mapId) where T : ControllerMap

    That overload calls for _mapId_, which you do not know. mapId is a unique id assigned to every Controller Map upon creation.

    Use this:
    public T GetMap<T>(int controllerId, int categoryId, int layoutId) where T : ControllerMap

    Or this:
    public T GetMap<T>( int controllerId, string categoryName, string layoutName) where T : ControllerMap
     
    Last edited: Apr 9, 2016
  3. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,191
    Perfect, thank you guavaman!
     
  4. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey,

    No worries, I thought outside of the box and concocted a Frankenstein way on how to retrieve the Actions.

    Thanks,
    jrDev
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    The UserData method isn't difficult and only requires a reference to the InputManager component in your script. But whatever works works.
     
  6. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey,

    Like you said, it might change when using user data, so I chose to use Reinput.mapping.actions instead.

    Thanks,
    jrDev
     
  7. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey again,

    So I am trying to do input event but it is not working.

    ReInput.players.GetPlayer(playerId).GetButtonDown(0)

    The above doesn't work, am I missing a step. I am testing with Keyboard so I have the Keyboard maps setup. Anything else I am missing?

    Nvm: I missed the step about adding the Maps to the Player.

    Thanks,
    jrDev
     
  8. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    Any plans for this to work with Inventory Pro?
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    I've got no plans to make an integration pack for Inventory Pro.
     
  10. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Hey guavaman. Im still using your asset in my game to good effect. Really appreciate the work put into it. Two questions:
    1) Could I politely ask you to produce an encrypted txt based version of your PlayerPref Save file module? I have tried to modify it, but the skills are weak. Adding a couple different module options for Save States would probably be a good thing for all sorts of users. Im asking specifically because I wipe all my player prefs and rebuild on version update, so players lose all their controller info. One master file hidden in Streaming Assets would magical, but if you can't, thats all good. :)

    2) Will you have support for Oculus Remote?

    Thanks, keep up the good work!
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Sorry. I don't have any plans on providing cross-platform data serialization systems with Rewired. This is really what is required to save and load data safely and reliably on all platforms. This task is left up to the developer if Player Prefs isn't sufficient. Player Prefs should fit the need for 99% of users, while the others have the ability to extend UserDataStore to use any kind of data storage system you desire. If you don't have scripting skills, you could always hire a freelance developer to code the class.

    Doubtful at present, but not ruling it out at some point. 1) Oculus devices require the oculus SDK to work as far as I am aware. 2) The remote is a touchpad and as such requires all the functionality of touch-based devices. Rewired is not designed to provide a touch abstraction layer at this time.
     
  12. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Roger that, thanks for the reply.
     
  13. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    331
    Hello Everyone!

    I would like to do something like rewired do in its window.

    In the Actions Button, there is a Category Area. When you select a Category, The Actions Area refresh with this info. When you select an action, the Properties refresh.

    Although my question is not about rewired. How this can be done in Unity? Is some kind of layout? I mean the area with some selectable labels, and you can select one label, get the label index and refresh other area.

    Thank you very much
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Rewired's UI is done with my own framework built on top of Unity's UI controls. It's fairly complex. None of those features you see a standard part of Unity's UI system. Even the listbox control was custom made.
     
    Maeslezo likes this.
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Hi,

    You'll be happy to know I was contacted by the author of Inventory Pro about him doing an integration for his asset. :)
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Rewired 1.0.0.84 is live on the Unity Asset Store.

    1.0.0.84:

    Changes:
    - Improved accuracy of button down detection when frame rate is extremely low and a button is pressed and released quickly on all platforms. (Note: XInput, being polling-based, still has the potential for button misses at low frame rates.)

    Bug Fixes:
    - OSX Fallback: Fixed bug in Sony Dual Shock 3 controller definition.
    - Float XML data is now read correctly when system's current culture expects commas instead of periods for decimal separator.
     
  17. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    Thanks.
    It did seem like something he would do from his side though I thought I'd crosspost the request here to make you aware :p
     
    guavaman likes this.
  18. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
  19. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    I've got a technical question:

    I have a couple different types of potential configurations for my game's coop mode:

    Option A: Player 1 = Keyboard/Mouse, Player 2 = Gamepad
    Option B: Player 1 and 2 = Gamepad

    When Option A is used, I'd need the first controller slot to be used for Player 2.
    So, I used the following commands to do this:

    rewiredPlayer2.controllers.ClearAllControllers();
    rewiredPlayer2.controllers.AddController(ReInput.controllers.Joysticks[0], false);

    This seems to work fine, except that my controller bindings for player 2 get reset every time this code runs. I've tried solving this issue a bunch of different ways to no avail -- any tips?
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    That's how it works. When a Player has no Joysticks assigned, it also has no Joystick Maps. When you assign a Joystick, Rewired loads the best matching Joystick Maps it can find from the Rewired Input Manager, which are always the defaults you've set up. You didn't say so, but it sounds like you've created custom bindings, perhaps with Control Mapper. These bindings are not automatically loaded when you manually assign the Joystick to the Player via scripting. Control Mapper does this for you when you assign the Joystick in there (or it gets auto-assigned on plugin when using a UserDataStore component), but it's not going to do that when you assign a Joystick manually.

    You must load your mappings from whatever save storage system you've saved them in after you assign the controller to the player. Saving and loading is shown here: http://guavaman.com/projects/rewired/docs/HowTos.html#saving-loading-controller-maps

    If you're using UserDataStore, you need to call one of the Load methods in ReInput.userDataStore: http://guavaman.com/projects/rewired/docs/api-reference/html/T_Rewired_Interfaces_IUserDataStore.htm
     
    Last edited: Apr 13, 2016
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
  22. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Glad it was released already.
     
  23. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    Gotcha, the function I was looking for was ReInput.userDataStore.Load().

    One (hopefully) last question: Is there a simple code-based way to select "Player 2" on the control mapper screen? Sorry if it seems like I'm asking for spoon-feeding here -- I've actually spent a lot of time setting up Rewired and the control mapper to do some pretty uncommon stuff, it's just hunting around the code and documentation for answers to these little one-line things end up costing me a lot of time.
     
    Last edited: Apr 13, 2016
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    No. There are no short-cut methods built into Control Mapper for selecting any UI elements. All selection is done through Unity's event system and Selectable components.
     
  25. CrazyD0G

    CrazyD0G

    Joined:
    Oct 2, 2014
    Posts:
    3
    Hello!
    Does the Rewired support input events from Apple TV Remove touchpad in simulator?
     
  26. centaurianmudpig

    centaurianmudpig

    Joined:
    Dec 16, 2011
    Posts:
    92
    Hi guavaman,

    I've added Rewired to my project and was very pleased at how simple it was to start using it.

    Having said that, I'm struggling to figure out how to get the Control Mapper to load the default mappings defined in the Rewired Editor. The mappings are loaded and functional, controlling my game object as expected. When I open the Control Mapper screen the mappings are not being populated for the keyboard and controller.

    I presumed it would automatically load them in, since they are already loaded and active inside of the game. What appears to be happening is that it just loads from Player Prefs, even if there are no saved mappings by the player. So, all the actions are empty, yet it seems to realise a binding exists when trying to map an action.

    TL;DR How do I get the mappings saved in the Rewired Editor to be displayed in the Control Mapper when there are no Player Prefs saved for a map?
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    It will automatically load them. There is no case I know of where it would be possible for these mappings to not be displayed in Control Mapper. They are taken directly from the Player objects from ReInput.players.Players using the same API as the rest of Rewired. If your game is controllable, the mappings cannot be missing.

    There has to be something else going on here. Please try the Control Mapper demos and see if it behaves any differently. Otherwise you'll have to send me your project so I can see if you've done something wrong. (I can't imagine anything you could possibly to do make the bindings not appear except maybe changing the text color to match the button background color.)

    Please be sure you have followed the setup instructions:
    http://guavaman.com/projects/rewired/docs/ControlMapper.html

    Another thing I would do is to clear Player Prefs if you have modified the Rewired Input Manager data at all since you started working with Control Mapper. You could be loading blank mappings for your Players that is saved in Player Prefs. (However, your game wouldn't control properly if this was the case.) See UserDataStore for information on how to clear Player Prefs.

    Edit: This was resolved by email. The issue was Control Mapper was set to edit/display only maps in the "Default" Map Category, but all Controller Maps were created in the "Pilot" Map Category. Changing the inspector setting to "Pilot" for the Map Category to display/edit fixed the issue.
     
    Last edited: Apr 14, 2016
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Rewired does not have any special handling or detection of using the Apple TV simulator. It gets the joystick information from UnityEngine.Input and if the controller is identified as a Siri Remote it will read the touchpad data from the appropriate axes on the Joystick from UnityEngine.Input. If this information is not provided in the same manner when in the simulator, it will not work. I have not used the Apple TV simulator.
     
    Last edited: Apr 13, 2016
  29. AcidsEcho

    AcidsEcho

    Joined:
    Oct 20, 2015
    Posts:
    2
    I have been having this issue...
    http://answers.unity3d.com/questions/1172153/multiple-xbox-controllers-trigger-axis-always-retu.html

    In addition to that issue, another problem I have is that one of my buttons will trigger an event on all instances of a player. For example, I press the jump button on controller 1, and players 1, 2 and 3 all jump. If i debug into the jump event, I get three hits on the input check, and each hit has the name you would get had you pressed that button on each players respective controllers. The button can vary each time I start Unity. It might be "A" this time and next time I load the project it could be "Y".

    Many many hours were spent head-scratching on the above two problems trying to figure out what I was doing wrong before discovering they were Unity problems.

    I was trying the input beta this past weekend to see if that would solve my issue (as the answer to my question suggested) and ended up losing over 20 hours of work when the new interface emptied all of my action maps and subsequently crashed so hard when I tried to re-add actions to them that Unity needed to restore itself to all default settings.

    So as a last resort, I am considering a third party plug-in to handle my input. At this point I feel like it's necessary to ask: Does rewire actually support 2-4 simultaneous players locally? By support I mean that a controller can be assigned in a script attached to a gameobject and all of that controller's buttons can do a specific thing to that object, and that object alone, in an environment where there might be other gameobjects present with their own controllers connected to the same machine.

    Also, has it been tested using a mixture of wireless and wired controllers? Unity's default input seems to ignore wired controllers if wireless controllers are attached or ignore wireless controllers connected after initialization if there is a wired controller attached (even though windows recognizes them all in device manager).

    In case it's relevant: my dev environment is Windows 10 64bit, Unity 5.3.4, and my input devices are a mixture of 360 wired controllers and Xbox one controllers connected through USB or wireless adapter. The target platform is a UWA running on Xbox One through the development program. I am not deploying to Xbox yet, all of these input woes are running locally.

    Sorry for the rant. I wanted to give you an idea of what I have been dealing with so you know what exactly I need a third party plugin to do (or not do, as it were) and can let me know if Rewired fits the bill.

    Thanks.
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    @AcidsEcho In short, Rewired does all of that and more. Try out the fully-functional free trial and see if it works for you.

    For an explanation of why this happens, see this post.

    I haven't seen this happen with one button, but I have seen many times after a bunch of hot-plugging of various controllers, UnityEngine.Input can go into a state where any button on any controller or mouse will activate ALL buttons on ALL controllers until you quit and restart Unity. Sounds similar.


    Yeah, that's not a beta. It's labeled "Experimental" and isn't even at alpha stage yet. Trying to use this for a production game would be a big mistake.

    Rewired works on the concept of Players. Joysticks are assigned to Players and you get your input from the Player in your scripts.

    Basics on how Rewired works:
    http://guavaman.com/rewired

    Intro video:


    Tons of information on the details of how Rewired works in the Docs:
    http://guavaman.com/rewired/docs

    Yes.

    UWA/P is a brand new supported platform that I just added in the last month. In my testing everything works, but being a brand new platform there could be some issues to work out.
     
  31. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    I had been working on Mac and Rewired worked perfectly. I got a separate Windows 10 machine and was working on the project there, but Rewired seemed to not work for the Xbox One controller (I made profiles for both kinds, Xbox One and Windows). Just mouse and keyboard were working through Rewired. The Xbox One controller is verified to work with other games on the same machine.

    Any advice?

    Also, could you add a profile for the Oculus Rift Remote? If you need me to run diagnostics to get you info like we did with the Nimbus, let me know what you need me to do. :)
     
  32. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    The Windows 10 problem with XBOX One sounds similar to the Microsoft driver problem. Have you seen msg #1775 in this Rewired thread?
     
  33. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
  34. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I am on Windows 8.1 so I am not blocked by this Microsoft bug.

    Have you tried just using raw or DirectInput only without having XInput checked and see if that works?
     
  35. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Are you using the latest Rewired 1.0.0.84?

    The information from the Halo forums says Microsoft Windows 10 patches/updates on April 12, 2016 solved some XBOX One controller problems.

    The previous suggestion in the Halo forums was the revert to a previous version of the XBOX One controller driver.

    http://forum.halomaps.org/index.cfm?page=topic&topicID=49128&start=36 (see msg #51)
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    As always, you have to know where the failure is happening before you can look for a solution.

    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#controller-doesnt-work

    The code posted in that Troubleshooting topic shows how you deal with issues like this to determine the failure point.

    The fact that "it doesn't work" can mean anything. 9 times out of 10, it's just a mapping problem -- the maps aren't loaded, not that the controller doesn't appear to the system or to Rewired. The fact that the mappings aren't loaded is easily discovered by using a small amount of debug code or even just running Control Mapper with the device attached. So if it shows up in Control Mapper and can be mapped, the controller does indeed work, but either a) the controller isn't recognized properly or b) there is no defined Joystick Map it can load.

    My guess in your situation:
    1. You have XInput enabled.
    2. You don't have a map defined for the Dual Analog Gamepad Template map. Therefore, to work, it must match the controller exactly when trying to load a map.
    3. Because XInput is enabled, as explained here, Rewired cannot know that this is an Xbox One Controller. It can only know that it's an XInput controller. This means it cannot use those controller specific Xbox One maps. It will use the Xbox 360 controller map instead (because the Xbox 360 controller definition matches all XInput devices on Windows when XInput is enabled.)

    The solution to this problem is to always use the Dual Analog Gamepad Template map, then you won't have to learn about all the different definitions that are used for the various input sources on various platforms. All you have to do is make one Controller Map and everything will work.

    Xbox One Controller and Xbox One Controller (Windows 10+) maps only work:
    1. If XInput is disabled on Windows Standalone.
    2. On other platforms that can identify the controller.

    The Windows 10+ profile is ONLY for Windows Standalone on Raw Input with XInput disabled when running on Windows 10 because Microsoft changed the Windows 10 Xbox One driver with different button and axis mappings.

    I don't have a Oculus Rift or an Oculus Rift Remote. But it looks like it has a touchpad. Supporting this is not nearly as straightforward as adding a controller definition. Further, if it doesn't show up as a standard HID joystick/gamepad, Rewired will not see it. If the device can work with Rewired, it will already show up as a joystick when attached. Run the Control Mapper demo and see if it works.
     
    Last edited: Apr 19, 2016
  37. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    Yep, running latest. Good news is switching to Raw Input but disabling XInput fixed it for the Xbox One controller. However, it breaks support for other controllers I had, like the PS4 DualShock 4 (which worked in Direct Input with XInput checked). Keyboard and mouse luckily still work, apparently always have here. Fortunately Nimbus on OS X still works for the Non-VR Mac version. Switching to this seems to have no blocker negative affects so far, considering I really only need Xbox One controller to support Rift games/apps since it comes with that.

    (^ written before guavaman reply)

    Okay, so all of this is super good to know. Microsoft Windows 10 needs special treatment for a de facto official Microsoft Windows controller, including disabling Microsoft XInput. Ughhhhh -- But yeah disabling XInput and switching to Raw accommodated it without breaking Nimbus support on Mac.

    Yeah so far on the Rift Remote, I haven't been using the touchpad much. The touch pad has click buttons in a D-Pad style built within it and the center click is basically Left Mouse Click. In Oculus Home, for example, that's all that's used. For touchpad, I'd say it'd be most useful to emulate Left Stick on a standard controller for the First Person Shooter paradigm (LS X = Strafe, LS Y = Movement), since most Rift games are going to be first-person perspective with basic locomotion needs. For the game I'm prototyping, I could almost get away entirely with that alone for all of the controls, simultaneously mapping traditional BAXY buttons to the touch-pad D-pad buttons. "Mouse Look" is handled by the Rift itself. When I get a chance, I'll run the profiler and post results.

    Speaking of Mouse Look, our recent hack to get Mouse Look mapped to RS now broke in Non-VR for Y-axis look but X-axis character controller rotation still works. But in VR mode, X & Y work, now set to Raw Input with XInput disabled. Weird. I'm using a Camera through Cinema Pro Cams for Non-VR but a regular Unity Camera for the VR cam, if that maybe has something to do with it. Still poking around to figure that out. Also, it first broke when I first started working with the same project across Mac and then also Windows. Otherwise the hack and Rewired worked perfectly when I was just developing on Mac. I tried toggling off VR support under Project Build Settings Other and it still behaved the same way.

    Just got my Rift up and running so I'm still figuring this out and seeing how much breaks with my project converting into VR and cross-platform Mac/Win development in Unity 5... Thanks for your guidance along the way!
     
    Last edited: Apr 19, 2016
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    I didn't suggest you disable XInput. Leave XInput enabled -- that provides the best support for XInput devices. Raw Input + Use XInput is the recommended configuration for Windows Standalone.

    The solution I gave was to create a Dual Analog Gamepad Template mapping. Everything else was just side explanations of why a certain definition is loaded depending on the chosen input sources.

    Windows 10 + Xbox One Controller works perfectly fine with Use XInput enabled -- in fact better than with it disabled.
     
    Last edited: Apr 19, 2016
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Dual Shock 4 works perfectly well with Raw Input. In fact better than with Direct Input because it can support vibration, light control, touchpad, and gyro when using Enhanced Device Support.
     
  40. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    Okay-- I'll double check this. Thanks! (PS: I was annoyed with Microsoft, not you! ;) ) Good news is things are working as needed. Getting closer to having all the platforms and controllers puzzle pieces fitting together. I'd be so screwed without Rewired (see also: massively annoyed with Unity on input, despite the otherwise daily miracles they perform haha). :) Thanks again for your stellar support and fast replies!
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    @Xander Davis

    If you have trouble with Dual Shock 4:
    1. Ensure you do not have any 3rd party tools installed that could alter the mappings or behavior of the joystick.
    2. Ensure you do not have any other software running that can take exclusive control of the DS4.

    If the above 2 do not solve the problem, you can disable Enhanced Device Support in the Rewired Input Manager Settings page which will disable support for vibration, touchpad, etc.
     
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    If it shows up and all elements are usable, I could make a definition. If not, it will require special code to work.

    VR mode should not affect Rewired's mouse output in any way. Do you have "Native Mouse Handling" enabled in the Rewired Input Manager? If not it will be using UnityEngine.Input for the mouse. ("Native Mouse Handling" only applies to Windows Standalone builds and Windows Editor.)

    So it would be important to determine whether the mouse Y axis values really are zero or if the issue is really with the camera controller. I suspect the latter if its affected by Unity's VR mode.
     
    Last edited: Apr 19, 2016
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    I didn't think you were. :p Just that you got the wrong solution from my message.
     
  44. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    Everything seems to be working by now. However, I cannot get the Rift Remote to show up. It just stays with the Xbox One Controller. Or if I turn it off, it says no joysticks detected, even if I press the Rift Remote buttons during playback.

    Hmmm...
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Then it's not a HID-compatible joystick or gamepad, which is what I expected. All this new VR gear coming out require special SDKs on each platform to use.
     
  46. maxxa05

    maxxa05

    Joined:
    Nov 17, 2012
    Posts:
    186
    Hi,

    I noticed that scrolling in a Unity UI ScrollRect doesn't work with a multitouch touchpad. I tried to activate the "Allow Mouse Input If Touch Supported" on RewiredStandaloneInputModule, but it changed nothing. Should it work out of the box? If not, is there a way to make it work?
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    What platform are you referring to?

    Touch input is handled by the Touch Input Module, not the RewiredStandaloneInputModule or the StandaloneInputModule.

    Edit: Great. Now I see on that page they've deprecated the Touch Input Module and moved its functionality into the StandaloneInputModule. I have not done the same for the RewiredStandaloneInputModule. Use the TouchInputModule or touch controls won't work. I don't see how I'm going to be able to support Unity 4.6, 5.0-5.2 and make all these changes to the module, but I'm going to have to try...
     
    Last edited: Apr 22, 2016
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Please try the new attached RewiredStandaloneInputModule.cs. It incorporates the new changes made in the Unity 5.3 version of the StandaloneInputModule.
    1. Replace the original in Assets/Rewired/Integration/UnityUI with the new one attached to this post.
    2. Remove the TouchInputModule on your EventSystem because it is no longer used.
    3. Enable "Allow Mouse Input if Touch Supported"
    4. Disable "Force Module Active"
    The Control Mapper demo scenes and the Rewired Event System prefab will be updated in the next version of Rewired to have the new default options enabled and the TouchInputModule removed.
     

    Attached Files:

    Last edited: Apr 22, 2016
    Acissathar likes this.
  49. maxxa05

    maxxa05

    Joined:
    Nov 17, 2012
    Posts:
    186
    Sorry, I was not clear enough. One of our players reported that he could not scroll in scrollable menus on his laptop without a mouse. I tested on my MSI laptop with a Synaptics touchpad and it was indeed impossible to scroll using the usual multitouch motion. I tested with the updated file, but it's still not working.

    I can scroll everywhere, except in Unity's ScrollRect. This morning, I tested using the default Unity UI StandaloneInputModule, and it's not working either, so it's not really your fault. I don't know if you can do anything about it, but it would be great if you could.
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625
    Thanks for the clarification.

    Are you trying to use a swipe gesture on the touchpad to scroll the area? If so, that probably wouldn't work unless it sends touch input to Unity instead of mouse button input or simulates the scroll wheel. I doubt that's the case. But with a mouse, the way to scroll a scroll rect is to use a slider bar on the side. Left click on the slider, then move the cursor just as you would with a mouse. I would imagine this would work with a touchpad exactly as it would with a mouse. Edit: Well I see you can also scroll the ScrollRect by clicking anywhere within and dragging the mouse... I could not possibly explain why this wouldn't work with a touchpad when it works with a mouse unless the touchpad is sending touch data instead of mouse data, in which case it's handled differently by the module.

    I really can't fix Unity's UI issues. It could be an issue in the ScrollRect control, or it may be an issue with Unity's mouse and/or touch handling at a low level not related to the StandaloneInputModule. Either way, I am no expert in the inner workings of Unity UI and it would take me a great deal of time to debug and figure out where the problem is if its even one that's possible to fix without having the Unity source code.
     
    Last edited: Apr 22, 2016