Search Unity

Rewired - Advanced Input for Unity

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

  1. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    The only way is to write a native input solution for Android and read the controller input directly from the Android API instead of from UnityEngine.Input (like Rewired does for Raw Input, Direct Input, XInput, Windows App Store, OSX, Linux, Xbox One, Ouya, and SDL2 Win/OSX/Linux.) Rewired does not offer this for Android at the present time. More native platforms are being added all the time as time permits (Windows 10 Universal is next), but Unity supports about 20 build platforms now, everyone one with serious input limitations/issues.

    Unity's decision to limit input to 20 buttons and their decision to map these controllers' buttons in the way they did is the cause and there is no possible workaround within Unity.
     
    Last edited: Jan 3, 2016
    Thorny2000 and AcidArrow like this.
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,789
    That's...

    I mean I'm sure there's some reason but "we can't support your controller because Unity only supports 20 buttons and on android it starts counting at 15" sounds so arbitrary.

    I started staring into the abyss that is Unity input problems the last few days... It hasn't been fun.
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Yes, it is unfortunate.

    As best I can determine, this is the reasoning behind the mapping:
    Unity Android sorts the inputs in a fixed order because of how Android's keycode-based system works. This allows Unity to simply map the keycodes in order and makes it possible for you to support nearly all gamepads on Android with a standardized layout unlike most other platforms Unity supports. They've reserved buttons 0-14 for these fixed keys. Starting at 15, they begin to list in order any remaining HID buttons. It's because they've reserved the first 14 buttons for specific HID usages, they're unusable by legacy controllers. None of this would cause a problem if they didn't have the arbitrary 20 button limit.

    However, there are dozens and dozens of gamepads made specifically for Android. Your users will only have issues trying to use older PC controllers on Android. (X360 and compatible work fine). It's not unreasonable to tell your customers that your game only supports XInput-compatible controllers and those made for the Android operating system. (FYI, most Android controllers don't work properly on Windows or OSX either, especially when using Unity Input, though Rewired can account for most of these anyway with use of my native input solutions.)
     
    AcidArrow likes this.
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Does your S3 happen to be rooted? I'm guessing so if you have Android 5.1 on it as mine is stuck at 4.4. Are you running any 3rd party software like Sixaxis Controller?

    I am unable to even get the DS4 to pair with the device. Same goes for Nvidia Shield on 5.1.1. "Wireless Controller" will never pair and just sits there connecting until the DS4 times out. Neither device is rooted.

    If rooting is required for the DS4 to pair in BT mode, it makes little sense to break support for USB mode which works without rooting in favor of BT mode as most players aren't going to be using rooted devices.
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired 1.0.0.79 is ready for download for registered users. If you would like to register to get early access to updates, please contact me here. The Unity Asset Store should get this update in 5-7 days.

    1.0.0.79:

    New Controller Definitions:
    - Saitek X52 Pro
    - Horipad Ultimate HIP-047U Wireless Gamepad


    Modified Controller Definitions:
    - Added OSX and OSX Fallback definitions for Logitech Rumble Pad 2
    - Added support for 2-port Mayflash GameCube Controller Adapter for Wii U & PC
    - Added support for 4-port Mayflash GameCube Controller Adapter for Wii U & PC
    - Removed matching criteria for Saitek X52 Pro from Saitek X52 definition

    Changes:
    - Added support for new Amazon Fire TV (2015).

    Bug Fixes:
    - XInput no longer throws an exception when Joystick.StopVibration() is called from a controller disconnect event.
    - Editor will now use the best available input source available to the editor when in Webplayer build target mode instead of falling back to Unity input.
    - Steam Controller fix can now be disabled in Rewired Input Manager.
    - Created separate controller definition for Saitek X52 Pro due to hardware differences.
     
  6. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Thanks. I am looking forward to the X-52 PRO changes.
     
    Last edited: Jan 8, 2016
    guavaman likes this.
  7. astroblastro

    astroblastro

    Joined:
    Feb 26, 2013
    Posts:
    5
    I was wondering if someone could give me some advice. I'm trying to make some smash brothers style UI. I found another thread that seemed to cover that style of input.

    http://forum.unity3d.com/threads/ho...trolled-by-the-keyboard-or-a-joystick.299656/

    But since one makes you disable the standalone input module i think maybe it might be the same case with rewired. Any idea how to use rewired to control multiple cursors on screen for some local multiplayer?
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    This is really a question for the Unity UI forum. Unity's UI system doesn't have support for multiple different simultaneously selected UI objects. You can certainly do it, but it's going to involve writing your own UI selection system on top of Unity's UI. This would be the case regardless of whether or not you're using Rewired to control cursor movement in your UI.
     
  9. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Rewired 1.0.0.79 is available in the asset store just in time for the weekend. Just started looking at the X52 Pro changes now.
     
    Last edited: Jan 8, 2016
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Thanks for the heads up! That was just 17 minutes after they sent me the notification email saying it was accepted! O_O
     
  11. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    Great plugin, I've just bought it!

    One question, I couldn't answer myself yet: Can Rewired use a joystick axis (e.g. Right Trigger) and call a one-time action (e.g. "Fire") as soon as it's axis value is above a certain threshold?

    I know I can just poll the axis for the value and fire the event myself, but I'm guessing that this sort of analog - digital conversion is already built-in. I'd like to keep my code at player.GetButton("Fire"), and then remap either a button or a joystick axis to it via Rewired.

    Thanks!
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Thanks! :)

    Call:
    player.GetButtonDown("ActionName")

    Docs: Actions
    Docs: How To's - Getting Input

    Modify the threshold for the Action in the Input Behavior -> Button Dead Zone:
    Docs: Input Behaviors

    (Edit: Mistakenly wrote Button Down Buffer instead of Button Dead Zone)

    The default settings usually suffice for detecting buttons from axes like triggers.
     
    Last edited: Jan 10, 2016
  13. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    Perfect, thank you! Much easier than I thought.
     
  14. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Hello there

    What would recommend as the best way to toggle between Apple TV Input Helper and Rewired?

    I want to test my local multiplayer game using Logitech gamepads and switch between Greg's asset and yours? Eventually I will port my game to PC so it is important to do it right.

    In other words, this game will release on Apple TV first but I need to test it in the editor with real controller input so that's when I will be using Rewired and I'd like to know the recommended way to handle it.

    Thanks
     
  15. guavaman

    guavaman

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

    Unforunately I cannot give you any assistance with Apple TV Input Helper because I have never used the asset.

    All I can tell you is you will need to do one or both of these:
    1. Branch your code based on which input sources/systems you are currently using.
    2. Create a wrapper class that does #1 so you can just make your calls to your wrapper class and it will choose which system to use without having to clutter your code with conditionals.

    You'd probably want to refrain from instantiating a Rewired Input Manager until you've chosen which system to use in your code. That way you're not wasting resources having it run if it's never used.

    FYI, Rewired also supports Apple TV with full gamepad and remote support. All MFI gamepads are supported. The Siri remote is supported as a joystick and exposes Tilt, Rotate, Gravity XYZ, and Acceleration XYZ, which can be mapped like any other controller element in a Joystick Map.

    You could potentially also feed certain data you get from Apple TV Input Helper into a Custom Controller if that's useful. For example, if it supports swipe gestures or whatnot, they may or may not be suitable to treat as Rewired Actions using that method.
     
    Last edited: Jan 13, 2016
  16. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Thanks for your answer.

    Would Rewired let me use the Siri remote or any controller like a mouse?

    In other words, let me track where I am in relation to the screen so I can click/select/drag anything on the screen?
     
    Last edited: Jan 13, 2016
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Like a Wiimote? No, because there is just not enough data returned by the remote to make that happen. I've tried, and it's just not possible. (Read about getting orientation from just an accelerometer. Pitch and yaw are possible, roll is not.)

    The reason is that Apple does not expose the gyroscope to you -- only the accelerometer. So all you have to work with is Gravity XYZ and Acceleration XYZ. This just isn't enough to build an accurate orientation Quaternion. (Unity's docs even mention this. The Orientation quaternion they now expose is only an estimate based on Gravity and is prone to all kinds of problems because it's impossible to know the rotation of the device in certain orientations.)

    The first generation Wiimotes used an accelerometer coupled with the infrared sensor. The infrared sensor provided the much needed extra point of reference which allowed it to be used as a pointing device. The later generations also added a gyroscope which made it even more accurate. You _could_ get a fairly accurate directional vector and orientation from just a gyro + accelerometer, but Apple does not expose the gyro to developers.

    The best you can do is detect Tilt (the degree pointing toward the screen) and Rotation (rotating the remote like an airplane propeller) independently of one another with the remote starting at a known point of reference.

    If however, you mean does it allow you to switch the Siri touchpad to return an XY position delta instead of a -1 to 1, that function is handled through Unity's special AppleTV classes to toggle the touchpad mode. However, currently the remote touchpad is clamped to -1 to 1, so returned deltas aren't accurate. This is something I will be changing soon so that it will not clamp these values.
     
    Last edited: Jan 13, 2016
  18. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Thanks for the thorough explanation.

    What about using the trackpad like a mouse? So you can assign a sprite and move it around like a mouse so you can click/drag etc.
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I explained that in the last paragraph above:

    "If however, you mean does it allow you to switch the Siri touchpad to return an XY position delta instead of a -1 to 1, that function is handled through Unity's special AppleTV classes to toggle the touchpad mode. However, currently the remote touchpad is clamped to -1 to 1, so returned deltas aren't accurate. This is something I will be changing soon so that it will not clamp these values."

    All it is is a mode that you switch to make Unity return "mouse" deltas instead of -1 to 1 values. However, Rewired currently clamps it. I need to fix this.
     
  20. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    Perfect!

    Will be changing my implementation to Rewired and will be waiting for your fix.

    Thanks
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I've made the change and it will be in the next update. Working on a few other things at the same time so it will be a few days.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Actually, I just tested on Apple TV and there is no fix required for this. It already works correctly in the current version because the value never exceeds +- 1. My understanding of the data returned by the Siri remote when in absolute mode was wrong. I thought it gave a delta like a mouse, but it actually just gives an absolute position based on where your finger is touching.

    Change the mode using Unity's Apple TV helper class:
    UnityEngine.Apple.TV.Remote.reportAbsoluteDpadValues = true;

    When true, it returns an absolute position. When false, it acts like a joystick with the center of the pad being 0,0 returning values +- 1. Switch it to absolute mode if you want to treat it like a mouse.
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I've been made aware of an issue with using Unity UI on tvOS with the Siri Remote. This is an issue with Unity's UI system and not Rewired, but I've created a workaround for the RewiredStandaloneInputModule that will prevent it.

    Until the next release of Rewired, replace the Awake method starting at like 244 in RewiredStandaloneInputModule.cs with the following:

    Code (csharp):
    1.         protected override void Awake() {
    2.             base.Awake();
    3.  
    4.             // Determine if touch is supported
    5.             isTouchSupported = Input.touchSupported;
    6.          
    7. #if UNITY_TVOS
    8.           // Deactivate the touch input module on TVOS so Siri Remote touchpad doesn't prevent joystick UI control
    9.           TouchInputModule tim = GetComponent<TouchInputModule>();
    10.           if(tim == null) tim = FindObjectOfType<TouchInputModule>();
    11.           if(tim != null) tim.enabled = false;
    12. #endif
    13.  
    14.             // Initialize Rewired
    15.             InitializeRewired();
    16.         }
    The issue:
    UI control may or may not work when using the Siri Remote touchpad.

    Explanation:
    The TouchInputModule is overriding the RewiredStandaloneInputModule because it’s running first and eating all events generated by the Siri Remote’s touchpad. The RewiredStandaloneInputModule’s ShouldModuleRun() is never being called in any frame that the Siri Remote’s touchpad is being touched. This includes swipes and clicks. The other remote buttons work correctly because the TouchInputModule is not being invoked in that case and the event falls through to the RewiredStandaloneInputModule.

    The workaround:
    Disables the TouchInputModule when tvOS is detected. The TouchInputModule can no longer consume the events generated by the Siri Remote touchpad and Unity UI will respond to joystick movements generated by the touchpad properly.

    More info:
    Whether or not the TouchInputModule consumes the events before the StandaloneInputModule gets them depends on the order of processing of the TouchInputModule and the StandaloneInputModule. There is no way to guarantee which will run first as Unity does not allow you to set this order based on the order of the Components on the GameObject. You could force one to run before the other by setting the Script Execution Order, but this seems excessive. This would explain why in one instance, you may have an issue with the RewiredStandaloneInputModule and not with the StandaloneInputModule. It may just happen to be that the StandaloneInputModule happened to be set to run before the TouchInputModule based on some internal ordering by Unity. You could remove the components and re-add them and get a totally different result the next time.
     
  24. JohanF_TF

    JohanF_TF

    Joined:
    May 20, 2015
    Posts:
    75
    It seems we can not get the Options button on DualShock4 working when running on PS4. It works fine in the editor, but when building to platform it seemingly fails to respond. Understand this isn't much to go on, just wondering if you might have any idea as to why this might be the case.
     
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    The editor is running in Windows or OSX. PS4 build isn't. The PS button is not available for mapping in a PS4 build.

    Rewired uses UnityEngine.Input on the PS4 platform as the underlying input source. The PS button is not usable using UnityEngine.Input as you can see by adding the Rewired/DevTools/JoystickElement identifier and a blank Rewired Input Manager to an empty scene and building it on PS4.

    I'm assuming Sony reserved the PS button for use by the OS as it always has the same function in every game I've seen on PS4. I haven't done any PS4 development myself to verify. If the button does nothing at all, then there is likely a function you have to call in Unity's PS4-specific classes to bring up the overlay.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I seem to have misread your post. I thought you said the PS button didn't work. As far as I am aware, the Options button should work. Please test using the JoystickElementIdentifier located in the Rewired/DevTools folder.

    1. Drag it into an empty scene. (Make sure position is 0, 0, 0).
    2. Create a Rewred Input Manager.
    3. Build to PS4.
    4. Just have one controller connected.
    5. Try pressing buttons and see what numbers appear.

    Option is currently mapped to Button 7 on PS4.
     
  27. JohanF_TF

    JohanF_TF

    Joined:
    May 20, 2015
    Posts:
    75
    Thanks for the tip

    The issue was an oversight on my part: We made some explicit controller assignment in Awake which worked fine in the editor, but it appears as that on PS4, the controller hasn't properly registered at that time. Rewired could only identify mouse and keyboard on Awake if I iterated over available controllers

    Moving the assignment to Start fixed it.
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I see, though I don't understand how that would only affect the Option button mapping. But anyway, when it comes to joysticks, if you need to make some kind of change or assignment at the start of the game, you should always use both Awake() and ReInput.ControllerConnectedEvent. Some platforms may detect connected joysticks in the very first frame while others may not depending on the input source. Using both Awake() and the event will guarantee you always catch all Joysticks.
     
  29. JohanF_TF

    JohanF_TF

    Joined:
    May 20, 2015
    Posts:
    75
    It's not that odd, it was sloppily tested on my part. The other functions worked, but that was because they were called from a player that had the controller auto-assigned. The faulty script explicitly assigned the controller to itself for limited use (but tried to assign it too early), such as pausing. Had I only tried to check other actions/buttons in the same script, the issue had been clearer.

    Thanks again.
     
  30. mgmhunt

    mgmhunt

    Joined:
    Apr 1, 2013
    Posts:
    63
    hiya, trying to get Controller Input via WebGL. See http://docs.unity3d.com/Manual/webgl-input.html .... maybe Rewired is checking for controllers before browser has given access ... not sure. Is there a write-up about this? Controller works fine in Editor. Keyboard input is working in both Editor and WebGL build.
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired handles WebGL through UnityEngine.Input. It checks for new controllers every 1 second. If it's not seeing any controllers, Unity isn't detecting any.

    There are many reasons why joysticks may "not work". You'll have to check all of these issues:
    1. Is Rewired creating any joysticks? Check ReInput.controllers.Joysticks.
    2. Is Rewired assigning them to your Player(s)? Check player.controllers.Joysticks.
    3. Is Rewired "recognizing" the controller so it loads the right Joystick Maps? This simply will not happen on WebGL. Rewired does not recognize controllers on WebGL (meaning identify by type and load a pre-defined definition) due to a plethora of show-stopping bugs and inconsistent behaviors and mappings that differ on every browser, every browser version, and every OS platform that runs Unity WebGL builds.

    So most likely, what's happening here is joysticks are being found, but nothing is recognized and everything is being treated as the Unknown Controller, and you don't have an Unknown Controller map, therefore you get no input.

    Read about the all the essential Joystick recognition, assignment, and mapping concepts here:
    http://guavaman.com/projects/rewired/docs/Controllers.html
    http://guavaman.com/projects/rewired/docs/ControllerMaps.html

    The short answer is the WebGL platform does not support joystick auto-recognition. Users must manually map their controllers via something like Control Mapper in order to use them. You can make an Unknown Controller map, but you won't really know what elements you're mapping Actions to.

    Support for joystick identification won't be changing until WebGL input becomes at least reasonably stable/reliable/not completely broken. It wouldn't be reasonable to include 20+ new controller definitions per existing controller to try to wrap this mess up (consuming increasing amounts of memory), and to continue to have to do so as browsers are released/change. Further, it may not even be possible to detect the current OS, browser type, and exact browser version from within Unity to do matching. Aside from the mapping differences, different browsers/versions/OS platforms have some real bugs that simply can't be worked around or wrapped to hide.
     
    Last edited: Jan 21, 2016
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Ahh, okay. Thanks for the clarification!
     
  33. libra34567

    libra34567

    Joined:
    Apr 5, 2014
    Posts:
    62
    Hi there, i followed the "Quick start" tour on rewired documents, so rewired is now working with my ps4 duel shock controller perfect in my multiplayer game, however, since my game need to use R/C(radio controller) controller, i tried to connected it with USB, however it's not giving any response, is there any lead i can follow?
    Thank you, love the work!
     
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    It is very unlikely that your R/C controller is a standard HID joystick device. If it's not, Rewired is not going to work with it. (What is the brand and model?)

    There are many layers to Rewired's joystick system:

    1. Low-level device - a HID device that shows up to the operating system as a gamepad or a joystick. You can only see these using the Rewired/DevTools/JoystickElementIdentifier tool. (Place in scene at 0,0,0, add blank Rewired Input Manager, press Play. Video here.)
    2. Rewired Joystick - Rewired will create a Joystick object for each valid HID device. List Rewired joysticks with ReInput.controller.Joysticks.
    3. Mapping - Rewired will attempt to recognize this HID device and load your Joystick Maps for it. If the device is not recognized, the Unknown Controller map will be loaded. (Explanations of Controllers and Controller Maps.) If you have not created a Joystick Map for this device, nothing will be loaded and you will not get any input response.
    4. Joystick Assignment - A Joystick must be assigned to a Player and matching Joystick Maps must also be assigned to that Player and enabled for you to receive input.

    Your joystick will only "just work" if all of the above happens.

    Start at the lowest level. If your device doesn't show up there and give back valid axis, button, and hat data, it will not work with Rewired. If it works at the low level, the next step will be to determine if a controller definition can be made for it to be recognized. (Various things about the information the device provides can prevent it from being a candidate for automatic recognition.) If it is, you can create a controller definition. The last step would be to create and assign Joysick Maps for it.

    If it appears and works properly at the lowest level, even if it is not a candidate for automatic recognition, it can still be mapped manually by the user using a controller remapping system such as Control Mapper. Run the Control Mapper example and see if it appears and can be remapped.
     
    Last edited: Jan 21, 2016
  35. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Not sure about your particular R/C transmitter and USB dongle but @devotid has at least one game that uses Rewired and a USB dongle.

    There was some discussion in msg #1280 in this Rewired thread which I will quote @devotid reply to my question below.

    >>
    Yes One USB Dongle has only 2 axis on it. One per transmitter. You are allowed 10 dongles or any style controllers per player in game. Rewired makes it too easy, as I can literally just play with one.... unplug and plug in another and keep rolling in seconds.
    <<
     
    Last edited: Jan 22, 2016
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I forgot about that. In fact, I didn't even realize he was using R/C controllers at the time. That's good to know at least some are standard HID joysticks. Thanks!

    If it is a standard HID joystick, Rewired will be able to see it and use it. It will need to be mapped though. Without creating a new controller definition for it, in-game remapping (like through the use of Control Mapper) is the best way to support it. It's also possible to use the Unknown Controller map assuming the axes and buttons are standardized across RC controllers.

    I did some searching on R/C controllers and found there are a few PC R/C controllers on Amazon:
    https://www.amazon.com/gp/product/B00K1P3KYW/ref=ox_sc_act_title_1?ie=UTF8&psc=1&smid=ATVPDKIKX0DER
    https://www.amazon.com/gp/product/B00IMJCVKI/ref=ox_sc_act_title_2?ie=UTF8&psc=1&smid=A2P5I4NW0QQAX1
    https://www.amazon.com/gp/product/B00RW736R8/ref=ox_sc_act_title_3?ie=UTF8&psc=1&smid=A1BKVSJG1RNAQO
    http://www.amazon.com/gp/product/B0...ue&ref_=ox_sc_act_title_4&smid=A2OEG1SKNGURE1
    https://www.amazon.com/gp/product/7293000014/ref=ox_sc_act_title_5?ie=UTF8&psc=1&smid=ATBLZ9RTDXRBW
    https://www.amazon.com/gp/product/B0033032VI/ref=ox_sc_act_title_6?ie=UTF8&psc=1&smid=ADEITUI78DBPL
     
  37. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    His game says it supports all Transmitter-USB-Dongle/Adapters. So others who want similar functionality have at least one reference of it working with Rewired.

    http://forum.unity3d.com/threads/rc-simulation-2-0-with-in-game-track-editor.369234/#post-2410880
     
    Last edited: Jan 24, 2016
  38. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    Question!!!!

    I am having problems to use the right stick button on an xbox one and xbox360 controller,basically it doesn't respond, neither within the editor or a windows standalone build.

    Any tips?


    Edit, appearently was our friend unity.... I've closed unity, reopen and everything works as expected....
     
  39. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    I can't seem get the Rewired Event System to call Submit on onEditEnd (Rewired 1.0.0.79).

    My menu navigation works, so it seems like the onClick events are being properly called by the Submit button. But my Submit button does not call onEditEnd on an InputField when I use a controller; it only works when I use the Return key on keyboard, which I assume is some sort of Unity default.

    The only EventSystem in my scene is a prefab that looks like this:

     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    First, when you post a question here, I need a whole lot more information about your setup to be of any help. I need to know at the very least:

    1. Unity version
    2. Rewired version
    3. OS platform
    4. Current build target
    6. Primary input source chosen in Rewired Input Manager -> Settings page

    And for this particular question, I'd need to know:

    1. If the OS and platform are Windows, whether or not Use XInput is checked in the Rewired Input Manager -> Settings page.
    2. As much information as possible showing your Actions and Joystick Maps so I can see if you've mapped things correctly.

    I don't see how this is possible. Closing the Unity editor will not affect a build in any way. I doubt it would affect the editor either, assuming you're using native input in the editor (Windows and OSX only).
     
    Last edited: Jan 26, 2016
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    The RewiredStandaloneInputModule is just a modified version of Unity's StandaloneInputModule source code. Since your issue is not specifically related to Rewired's functionality but rather the functionality of Unity's Event System, please test this using Unity's StandaloneInputModule first. Unless Unity has made changes to the source code that I haven't mirrored in the RewiredStandaloneInputModue that causes it to fire the OnEditEnd event on a joystick button press, there should be no difference between the two.

    In other words, if Unity's StandaloneInputModule doesn't fire OnEditEnd when using a joystick button, neither will the RewiredStandaloneInputModule.
     
    Last edited: Jan 26, 2016
  42. Patrascu

    Patrascu

    Joined:
    Jan 20, 2016
    Posts:
    59
    Hi,

    We're getting this error when trying to use the plugin on Xbox One:

    Unable to resolve pinvoke method 'Rewired.Utils.ExternalTools:Ext_Gamepad_UpdatePlugin ()' Re-run with MONO_LOG_LEVEL=debug for more information.

    Any ideas on what is causing this?

    Thanks
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Yes. The documentation shows you what you need to do to set up the Xbox One platform:
    http://guavaman.com/projects/rewired/docs/SpecialPlatformSupport.html#xbox-one

    This is linked from the Installation page of the docs and the main table of contents.
     
  44. Patrascu

    Patrascu

    Joined:
    Jan 20, 2016
    Posts:
    59
    Thanks for the quick answer. I already set up everything as described in the docs.

    It seems though that the problem is not Rewired, but the Xbox Gamepad native plugin. Tried using Unity's managed Gamepad plugin and got the same error.
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    It sounds like either you placed the DLL in the wrong location and Unity cannot find it or they recompiled the DLL and changed the function signatures. Unity Xbox One comes with the source code for those DLLs. If you have it, you can compare it to what is being called. Obviously, if they did this, it will break anything that's dependent on the DLL. But they tend to do things like that.

    EDIT: This has been resolved. Patrascu let me know that he was using the wrong version of the native DLL. After using the correct version, everything works correctly.
     
    Last edited: Jan 28, 2016
  46. Deedlithh

    Deedlithh

    Joined:
    Dec 21, 2015
    Posts:
    8
    Hi :)

    Is it possible to use Android Device or IOS Device (without USB) as a remote on my PS4 and Xbox One ?
    If it's possible , after connection between Device and my console, can i have acces to the data device ?

    Thx,
    Regards,
    Cindy
     
  47. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    Believe it or not, sometimes windows 10 + unity (5.2.3p3) do some weird stuff, for example if I boot windows WITHOUT having my xbox one controller plugged in, sometimes neither unity nor the build respond to the joystick (xinput was selected btw). Other times it just work as expected, I plug my controller, I open the game and all works...

    Why this thing happens?, no idea, but it happened more than once to me.
     
  48. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Wondering if this is related to using a Unity patch release (e.g. 5.2.3p3) compared to a full Unity release (e.g. 5.2.3)? Are you using a 64-bit or 32-bit Unity editor? Are you using Windows 10 pro or enterprise version? Is this a 32-bit or 64-bit version of Windows 10?
     
    Last edited: Jan 26, 2016
  49. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    Windows 10 home 64 bits, same goes for unity, 64bits version. I didn't tried if this thing happens with the full unity release, due the bugs with unity I've updated to a patch release so...
    And this bug happens from time to time it's not something that happens all the time. So It's not something that can be reproduced all the time :/
     
  50. Steamroller

    Steamroller

    Joined:
    Jan 2, 2013
    Posts:
    71
    First off, great tool. It takes a little bit of brain reprogramming to full understand this approach but it make way more sense and incredibly flexible when it clicks.

    This is an epic thread and impossible to search if this has already been discussed so please forgive me if is has already been covered.

    Two questions:

    Is there a way to find out which input behavior is assigned to a particular action?

    I need to check if action was tapped or held, so i think I need to find out how long a button was pressed after its been released? I see you have a GetButtonTimePressed() function but that returns 0 if the button has already been released. Any advise?