Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Rewired - Advanced Input for Unity

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

  1. indieDoroid

    indieDoroid

    Joined:
    Jan 25, 2016
    Posts:
    226
    Thanks for the response. Sorry, I'm not a programmer, so all this is a bit unfamiliar for me. I'm doing my best.

    When I make builds for myself, I just used [T] Gamepad Template and it worked just fine with my Xbox One controller, but when I gave the build to my friend he wasn't able to use his Xbox 360 Controller.

    I made the adjustments and posted a screenshot, can you please confirm if this is ok?

    Let me know if I'm missing something else.

    Also I'm just building for Windows PC, I'd like to have keyboard and xbox controller support.

    Thanks again
     

    Attached Files:

    • 11.jpg
      11.jpg
      File size:
      535.2 KB
      Views:
      366
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    1) Yes, but the name of Xbox 360 Controller is still purple. Did you delete all blank Controller Maps in all Layouts? I cannot see the Layouts list box on the Joystick Maps screen in the screenshots you posted. Also, the Category Default has an asterisk next to it which indicates there is still a Controller Map in that category. Post a full screen shot of the Xbox 360 Controller joystick maps.
    2) Yes.
    3) No. Do not change the Primary Input Source to XInput or ONLY else XInput-compatible controllers will be usable.

    Your friend not being able to use his Xbox 360 Controller likely has nothing to do with Controller Maps. There are many reasons why a joystick may not work. You are going to have to figure out exactly what is happening on his end.

    Without having any information to go on, the most likely cause would be Joystick assignment:

    From the Controllers documentation:
    http://guavaman.com/projects/rewired/docs/Controllers.html#joystick-auto-assignment

    Joystick Auto-Assignment

    By default, Joysticks will be assigned to Players (excluding the System Player) automatically based on the Joystick Auto-Assignment settings in the Rewired Editor - Settings. These settings allow you to change various options for how Joysticks are auto-assigned to Players based on the needs of your game. Joystick auto-assignment can be disabled if you'd prefer to assign joysticks manually through scripting. Joystick auto-assignment can also be selectively disabled per player in the Rewired Editor and via scripting.

    Note: One common issue that arises is when you connect multiple controllers and want a single Player to be able to use any of the connected controllers. Based on the default settings, Rewired will assign only one controller per-Player. In order to allow auto-assignment of multiple Joysticks to the same Player, Max Joysticks Per Player must be raised to a value greater than 1. All these settings are configurable and have descriptions as to their function.

    ----

    The paragraph I highlighted purple is a very common problem for developers who just leave everything at the defaults. If the player has multiple controllers connected or other virtual joysticks that appear to Rewired (VJoy, etc.), it is likely one of these other controllers will be assigned but the other will not.

    You should also provide your users a way to map unknown controllers and reassign controllers. Control Mapper is suitable for most games. If this is a controller assignment problem, your friend would be able to see it here and assign the right controller to his Player.
     
  3. frostyFroggs

    frostyFroggs

    Joined:
    Aug 6, 2015
    Posts:
    3
    I have a small problem with the Joycon Nintendo Switch. He does not recognize the buttons that I associated with him and I do not find in the document how to access the gyro. (I have the Nintendo Switch SDK)

    do I have to do anything to link the SDK and Rewired plugin?

    EDIT : And it's work when i use directly the SDK for the gyro. ( SixAxisSensor )
     
    Last edited: Sep 25, 2018
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    I cannot discuss the Nintendo Switch here due to the NDA. Contact me on the support form: http://guavaman.com/rewired#support

    Did you apply for the Rewired Nintendo Switch plugin on the Nintendo Developer Portal and install it? Documentation is included.

    http://guavaman.com/projects/rewired/docs/SpecialPlatformSupport.html#nintendo-switch
     
  5. the_dunderman

    the_dunderman

    Joined:
    May 4, 2017
    Posts:
    4
    Hey! So I've been trying to follow your guy's glyph code example in your Documentation here
    http://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action
    I'm trying to show certain glyphs based on the template being used. For our game, two players share a single controller. Player 1 can jump with left bumper, player 2 can jump with right bumper, but both buttons use the same action called "Jump".

    I am having many problems. First is I can not find a way to get my template I am using with code. The documentation is for Rewired v1.0.0.0 and we are using Rewired v1.1.7.8.U5
    Because of this many things go wrong when I try and follow even the general algorithm for connecting glyphs to templates.
    An easy one I fixed on my own was changing the typing of my template from HardwareControllerTemplateMap to
    HardwareJoystickTemplateMap.
    The next ones are not so easy. IControllerTemplate is an interface that does not exist anymore, and I have searched through many, if not all, Rewired namespaces looking for it. Templates are easily grabbed using controller.Templates[0]. The list goes on. Is there updated documentation anywhere?

    Lastly, after getting all the namespace errors resolved, my first idea to fixing my two buttons to one action issue is to also grab the controllers JoystickMap and show the correct glyph in accordance to the name of the JoystickMap grabbed. How can I find my JoystickMap within my template using either the controller or player? I found controller.mapTypeString, but all this returns is either JoystickMap or Keyboard, not the actual name of the map being used. Thanks for all the help, and sorry for the long post, but I'm becoming frustrated and desperate.
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    This message is really confusing on multiple levels.

    "The documentation is for Rewired v1.0.0.0 and we are using Rewired v1.1.7.8.U5"

    Where are you finding documentation for Rewired 1.0.0.0? This is not published anywhere.

    The online documentation version is 1.1.19.9:
    http://guavaman.com/projects/rewired/docs/

    The documentation that comes with the Rewired release you are using is equal to the release version. If you're using 1.1.7.8, the documentation that comes with it, if you choose to install it, is for 1.1.7.8. (This is a very old version of Rewired -- 33 releases behind current.)

    IControllerTemplate exists. If you do not have this interface, the version of Rewired you are using is too old and from before the interface was created. IControllerTemplate was added in 1.1.13.0. http://guavaman.com/projects/rewired/docs/ReleaseNotes.txt

    You should not be having to modify anything with regard to HardwareJoystickMap or HardwareJoystickTemplateMap and you should not have any namespace issues. HardwareControllerTemplateMap was also added in 1.1.13.0 as a base class to HardwareJoystickTemplateMap. The code in the example doesn't have any errors provided you are using the correct version of Rewired. Install the latest version of Rewired from the Unity Asset Store. Follow the Updating Rewired documentation.
     
    Last edited: Sep 26, 2018
  7. frostyFroggs

    frostyFroggs

    Joined:
    Aug 6, 2015
    Posts:
    3
  8. indieDoroid

    indieDoroid

    Joined:
    Jan 25, 2016
    Posts:
    226
    Hmm Ok I'll look more into the Joystick auto assignment.

    I asked my buddy about his set up. I'll get back in a bit!

    Thanks



     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    I don't understand the question. The Nintendo Switch plugin for Rewired is free. You just have to sign up for it on the Nintendo Developer Portal.
     
  10. the_dunderman

    the_dunderman

    Joined:
    May 4, 2017
    Posts:
    4
    Hey guava, thank you so much for the speedy reply, you're a life saver.

    I got confused because when I went to look up the Interface on the documentation, it said the version of the Interface, which was 1.0.0.0, you were correct about the version of the entire Rewire though. Updated our project with the newest version and all is well now.

    Sorry for the confusing post from before
     
    guavaman likes this.
  11. Dreamcube017

    Dreamcube017

    Joined:
    Dec 20, 2009
    Posts:
    239
    Hi,

    I'm using Rewired with Unity 2018.1 and PlaMaker. I set up a small menu and created some actions in rewired like up and down. In PlayMaker, I have each menu option in its own state with a transition for PRESS DOWN or UP.

    When I press down, it seems like PlayMaker reads the input a bunch of times and just goes right to the last choice. Same goes for Up.

    So I tried using Single Button Down, and it works, but now there's like half second delay between every press.

    As a test, I put in a standard Get Input PlayMaker action and it works as expected.

    Did I forget something? Thanks!
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    What Action are you using to get the Up/Down state?
     
  13. Dreamcube017

    Dreamcube017

    Joined:
    Dec 20, 2009
    Posts:
    239
    I'm using Rewired Get Player Single Button Down. I was just using Rewired Player Get Button Down, but that's when it would quickly jump through the commands.
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    RewiredPlayerGetButtonDown is the correct Action to use. It returns true only on the first frame the button is activated. RewiredPlayerGetSingleButtonDown is for a different purpose. Refer to the description of the Action.

    How are you acting on the result of the RewiredPlayerGetButtonDown? Are you using the True event or are you storing the value of the result and using that?

    Have you set the ButtonDownBuffer of the Action's Input Behavior to a non-zero value?

    What type of control is the Action mapped to? Keyboard, mouse button, joystick axis, etc. Does it matter what type of control you map it to?
     
  15. fluidImages

    fluidImages

    Joined:
    Sep 27, 2013
    Posts:
    29
    Hey there, I am sure a simple issue/question..
    I have created everything the way I like - all is working..but now into the detail.

    I have created mobile touch controls yours) and I those controls to hide and show when any controller is used.

    I am using something very simple to unhide
    Controller controller = player.controllers.GetLastActiveController();

    if (Input.touchCount > 0)
    {
    hud.goTouchControl.SetActive(true); //This unhides the TouchControls.
    controller = player.controllers.CustomControllers[0]; //I assume this is setting the custom controller to active.
    }

    the problem is that the next time I use GetLastActiveController().. it uses the one before - like the line:
    controller = player.controllers.CustomControllers[0]; is only temporarily setting it.

    I am sure this is something I am doing dumb.
    Sean
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    • You have a local variable called controller.
    • Every time this method is called, you are setting the value of controller to the last active controller.
    • Only when a touch is currently active, you are then overriding this value with the Player's Custom Controller.
    • The moment you lift the finger up and InputTouchCount returns 0, your controller variable is going to be reset to whatever player.controllers.GetLastActiveController is set to.
    • There is no guarantee that player.controllers.GetLastActiveController will return the CustomController. Touching the screen in Unity will also activate the mouse and if your Player has MouseMaps assigned that bind anything to a mouse button press or a mouse axis, the mouse will be chosen as the last active controller. Any input on a joystick or keyboard would also override the CustomController and be returned.
     
  17. fluidImages

    fluidImages

    Joined:
    Sep 27, 2013
    Posts:
    29
    any recommendations or techniques on how we may hide mobile controls when someone uses the joystick, keyboard or mouse controller and shows them when someone touches the sceen? (uses the customer controller)
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    Even if you disable touch mouse simulation (https://docs.unity3d.com/ScriptReference/Input-simulateMouseWithTouches.html), GetLastActiveController() will never return the CustomController until the touch controls actually receive some value by having the user interact with them. Just because they're visible doesn't mean they're active.

    The only way you could do it the way you're attempting using GetLastActiveController would be to make another CustomController that has a script that sends some value to the Player every time the screen is touched anywhere using a script to pipe in this value. You would have to make an Action that has no purpose but to detect a screen touch. The Player would need to have this CustomController assigned and a ControllerMap assigned that mapped this Action. This would set the LastActiveController in the Player every time the screen was touched and then your code would work.

    Alternately, you could use a different approach of checking Controller.GetLastTimeActive on all Joysticks, the Keyboard, and the Mouse to determine the last time any non-CustomController was Active. If there is a current touch active and the last time was less than the current time, bring up the touch controls. If no touch is active and the last time is the current time (see notes in the method), hide the touch controls.
     
  19. Dreamcube017

    Dreamcube017

    Joined:
    Dec 20, 2009
    Posts:
    239
    Sorry for the delay and thanks for the quick response.

    I am using the TRUE event and not storing the value.

    I set it to .1 then .5 and then 1, but it still happens.

    I am using a Dualshock4 controller. I'm using the DPad and left analogue stick to move. I am going to map it to a generic controller as well. I will test it with an Xbox One controller (using generic XInput mapping) to see if it happens with that as well.
     
  20. Dreamcube017

    Dreamcube017

    Joined:
    Dec 20, 2009
    Posts:
    239
    I just tried it with the generic controller template using the wired Xbox One controller and the same thing happens. Should I be storing the value instead of just using TRUE?

    Here is how my actions are set up.

    upload_2018-10-1_8-50-22.png

    upload_2018-10-1_8-52-31.png

    When I press down, it jumps right through the restart action to exit. Same goes for exit if I press up. I am currently using a buttonDownBuffer of 1 in the behavior settings.
     
  21. Manufacture43

    Manufacture43

    Joined:
    Apr 21, 2017
    Posts:
    129
    Hello,

    I'm having crash reports from people running ubuntu 16.04 and input issues from people using ubuntu 18.04. Apparently, there was some changes in libudev for steam and some unity games are now having problems. It would seem, so far, that these games use rewired. (a lot of guessing is going on here...)

    Anybody having the same issue?
     
    Last edited: Oct 1, 2018
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    The reason is you are querying for GetButtonDown from the "down" Action multiple times in the same frame. GetButtonDown will always remain True for the "down" Action throughout the entire frame. Only on the next frame will it return to False. Your code is executing the first GetButtonDown("down"), getting the True result, then in the same frame executing the second GetButtonDown("down") and also getting the True result and acting upon it.
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    First I've heard of it. I cannot go test everything over again at the moment because I do not have access to my Linux setup at the current time.
     
  24. Manufacture43

    Manufacture43

    Joined:
    Apr 21, 2017
    Posts:
    129
    Ok, I'm investigating. So, for one of the two users, he had a custom libudev that fixes issues for him in KDEnlive but introduces problem in various unity (and rewired ? not sure so far) games, so that's the "reason".

    I couldn't reproduce the issue on my side so far, on two machines. One with a live cd and one with a fresh install with all the updates. I'm going to upgrade to 18.04 to see if I can get something. The logs from both of them don't exhibit anything peculiar, except for not loading libudev in one case.

    Edit: I'm seriously starting to doubt this has anything to do with libudev and/or rewired
     
    Last edited: Oct 1, 2018
    guavaman likes this.
  25. indieDoroid

    indieDoroid

    Joined:
    Jan 25, 2016
    Posts:
    226
    @guavaman Just letting you know the advice you gave works. My friend can get his xbox 360 controller working now! Thanks :)


     
    guavaman likes this.
  26. Dreamcube017

    Dreamcube017

    Joined:
    Dec 20, 2009
    Posts:
    239
    So should I put in a state to make sure it waits until the end of the frame? If I uncheck "Every Frame" it won't be checking to see if the button is pressed every frame?

    EDIT: I fixed it by putting one wait state for down and one wait state for up and changingthe buffer back to 0.05.

    Thanks!
     
    Last edited: Oct 4, 2018
  27. Rockwall33

    Rockwall33

    Joined:
    Mar 4, 2016
    Posts:
    186
    Hello!

    I tried 8 players and it did not work out, so I kicked it down to 4. I was using Corgi's pause screen example as a start. I put Rewired event system in and the pause menu comes up, but my joystick wont move any of the buttons, any ideas how to fix?

    Here is the error:

    Rewired: Exception drawing properties:
    UnityEngine.ExitGUIException: Exception of type 'UnityEngine.ExitGUIException' was thrown.
    at UnityEngine.GUIUtility.ExitGUI () [0x00007] in C:\buildslave\unity\build\Modules\IMGUI\GUIUtility.cs:148
    at UnityEditor.EditorGUI.DoObjectField (Rect position, Rect dropRect, Int32 id, UnityEngine.Object obj, System.Type objType, UnityEditor.SerializedProperty property, UnityEditor.ObjectFieldValidator validator, Boolean allowSceneObjects, UnityEngine.GUIStyle style) [0x002ff] in C:\buildslave\unity\build\Editor\Mono\GUI\ObjectField.cs:173
    at UnityEditor.EditorGUI.ObjectFieldInternal (Rect position, UnityEditor.SerializedProperty property, System.Type objType, UnityEngine.GUIContent label, UnityEngine.GUIStyle style) [0x00053] in C:\buildslave\unity\build\Editor\Mono\EditorGUI.cs:3231
    at UnityEditor.EditorGUI.DefaultPropertyField (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) [0x001f8] in C:\buildslave\unity\build\Editor\Mono\EditorGUI.cs:5659
    at UnityEditor.PropertyHandler.OnGUI (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren, Rect visibleArea) [0x00118] in C:\buildslave\unity\build\Editor\Mono\ScriptAttributeGUI\PropertyHandler.cs:149
    at UnityEditor.PropertyHandler.OnGUI (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) [0x00025] in C:\buildslave\unity\build\Editor\Mono\ScriptAttributeGUI\PropertyHandler.cs:106
    at UnityEditor.EditorGUI.PropertyFieldInternal (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) [0x0000b] in C:\buildslave\unity\build\Editor\Mono\EditorGUI.cs:5562
    at UnityEditor.EditorGUI.PropertyField (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) [0x00005] in C:\buildslave\unity\build\Editor\Mono\EditorGUI.cs:6878
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.SerializedPropertyAdaptor.‬
‌‫‭‪‪‮‏‪‏‮‫‎‬‮‍‍‍
‫‪‬‫‏‎‮ (Rect , UnityEditor.SerializedProperty , UnityEngine.GUIContent , Boolean ) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.SerializedPropertyAdaptor.DrawItem (Rect position, Int32 index) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListControl.DrawListItem (Rect position, IReorderableListAdaptor adaptor, Int32 itemIndex) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListControl.DrawListContainerAndItems (Rect position, IReorderableListAdaptor adaptor) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListControl.DrawLayoutListField (IReorderableListAdaptor adaptor, Single padding) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListControl.Draw (Int32 controlID, IReorderableListAdaptor adaptor, Rewired.Editor.Libraries.Rotorz.ReorderableList.DrawEmpty drawEmpty) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListControl.DrawControlFromState (IReorderableListAdaptor adaptor, Rewired.Editor.Libraries.Rotorz.ReorderableList.DrawEmpty drawEmpty, ReorderableListFlags flags) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListGUI.‬‪‪‫‮‮‬‬‫‮‭‏‮‌‌‌‍‍‍‮‌‪‬‍‏‮ (IReorderableListAdaptor , Rewired.Editor.Libraries.Rotorz.ReorderableList.DrawEmpty , ReorderableListFlags ) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListGUI.uQNgvaAnlcPOOeojlxRVDPWtnAWv (UnityEditor.SerializedProperty , Single , Rewired.Editor.Libraries.Rotorz.ReorderableList.DrawEmpty , ReorderableListFlags ) [0x00000] in <filename unknown>:0
    at Rewired.Editor.Libraries.Rotorz.ReorderableList.ReorderableListGUI.ListField (UnityEditor.SerializedProperty arrayProperty) [0x00000] in <filename unknown>:0
    at Rewired.Editor.RewiredStandaloneInputModuleInspector_Internal.‍‫‎
‏‬‏‮‏‎‏‍
‎‌

‍‭‍‎‏‎‍‮ (UnityEditor.SerializedProperty ) [0x00000] in <filename unknown>:0
    at Rewired.Editor.RewiredStandaloneInputModuleInspector_Internal.DrawProperties () [0x00000] in <filename unknown>:0
    at Rewired.Editor.RewiredStandaloneInputModuleInspector_Internal.OnInspectorGUI () [0x00000] in <filename unknown>:0
    ------- Rewired System Info -------
    Unity version: 2018.2.10f1
    Rewired version: 1.1.19.9.U2018
    Platform: Windows
    Editor Platform: Windows
    Using Unity input: False

    UnityEngine.Logger:LogError(String, Object)
    Rewired.Logger:LogErrorNow(Object, Boolean)
    Rewired.Logger:LogError(Object, Boolean)
    Rewired.Logger:LogError(Object)
    Rewired.Editor.RewiredStandaloneInputModuleInspector_Internal:‬‪‬‎‫‍‪‬‬‍‌‍

‮‫‌‭‮‭‏‏‫‮(Object)
    Rewired.Editor.RewiredStandaloneInputModuleInspector_Internal:OnInspectorGUI()
    Rewired.Editor.CustomInspector_External:OnInspectorGUI() (at Assets/Rewired/Internal/Scripts/Editor/CustomInspectors/CustomInspector_External.cs:19)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Thank you!!
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    The exception you posted has nothing to do with input not working in your UI. This is an editor inspector error. You would never see it if you don't have the RewiredStandaloneInputModule selected in the hierarchy. I don't know why you're getting that error. I can't reproduce it. It's coming from Rotorz Reorderable Lists, an editor library for displaying reorderable lists in the editor.

    Follow the setup instructions for the Rewired Standalone Input Module:
    http://guavaman.com/projects/rewired/docs/RewiredStandaloneInputModule.html

    The documentation page addresses everything from setup to known issues. Your problem is most likely this.
     
    Last edited: Oct 4, 2018
    Rockwall33 likes this.
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    8 player input is not difficult to set up. I have done it for you. Players 4-8 do not have keyboard maps because there's just not enough room on the keyboard for 8 players.
     

    Attached Files:

    Rockwall33 likes this.
  30. Rockwall33

    Rockwall33

    Joined:
    Mar 4, 2016
    Posts:
    186
    I will take a look at that! Thank you!!
     
  31. Rockwall33

    Rockwall33

    Joined:
    Mar 4, 2016
    Posts:
    186
    Oh I’m sorry, I was not very clear, my USB ports didn’t work for 8, when 4 were connected, 4 did not work. I found it weird, but I couldn’t fix it, I tried everything (this was for joysticks, I got everything in rewired good, as I said weird issue). Even calibration. If it gets figured out that would be cool, but don’t worry all is good with 4.

    Thank you!
     
    Last edited: Oct 4, 2018
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    Did you disable XInput? http://guavaman.com/projects/rewired/docs/KnownIssues.html#more-than-4-xbox-controllers
     
    Rockwall33 likes this.
  33. Rockwall33

    Rockwall33

    Joined:
    Mar 4, 2016
    Posts:
    186
    I don’t think I did.

    EDIT- I tried it, it does work! I did not uinderstand how to fix inputs since the 5 player was switched (A was shoot, other 4 was left bottom trigger 2).

    Since I will be publishing on Xbox and PC It would be nice to have Xinput, I think I am just going to keep it 4 players.
    9
    EDIT EDIT- I fixed the problem, doing 8!!


    Thank you!!
     
    Last edited: Oct 4, 2018
  34. Rockwall33

    Rockwall33

    Joined:
    Mar 4, 2016
    Posts:
    186
    I tried the Rewired Standalone Input Module, it did not move across the UI, only make it visible/invisible (which is good button works :) ). Any more ideas?

    Thank you!!
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    Did you look at this link I posted?

    You cannot navigate in Unity UI with a keyboard or joystick unless you have a Selectable object selected first. This is the single most common mistake people make using Unity UI.

    If a Selectable is selected in the EventSystem, the only things that could possibly prevent navigation from working are:

    1. The Actions set in the Rewired Standalone Input Module must be set to Actions that exist in the Rewired Input Manager, you must create Controller Maps that map these UI Actions, and the Controller Maps must be assigned to the Player and enabled.

    2. The Player(s) that can interact with the UI must be set to be allowed to control the UI in the Rewired Standalone Input Module inspector.

    This is all covered in the Rewired Standalone Input Module documentation:
    http://guavaman.com/projects/rewired/docs/RewiredStandaloneInputModule.html

    Use the Debug Information tool to view the results of Actions live during runtime, to view controller assignments to Players, to view loaded Controller Maps, and everything else. This is always the first thing you should do when something doesn't work because it allows you to figure out why without just guessing.

    In addition, the Selectable component itself must specify a Navigation mode other than None. If Explicit, the Selectables that are to be selected for each direction must be specified.
     
    Rockwall33 likes this.
  36. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    279
    Im running third person cover shooter, controller. Does this asset, allow me to just map the current unity inputs to a xbox1 controller?
     
  37. Rockwall33

    Rockwall33

    Joined:
    Mar 4, 2016
    Posts:
    186
    Man I am really sorry I missed it, thank you for bringing it up!

    I will be sure to look closer next time, I was on that same page when I looked UI.

    Thank you for everything!!

    Thank you!!
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    No. Rewired is its own system independent of Unity's input system.

    Rewired uses Unity input system on some platforms or if you choose for it to be the Primary Input Source, but it creates its own entries in the Unity Input Manager to get input from all devices.

    In some cases, you can use Unity Input Override to redirect input from Unity to Rewired without changing your scripts:
    http://guavaman.com/projects/rewired/docs/UnityInputOverride.html
     
    Last edited: Oct 5, 2018
  39. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Hello, I just wanted to see what the status of .Net 4.x is with Rewired. I've experimented with it and it seems to work just fine, but are there any known limitations/issues when switching the scripting backend to it? Thanks!
     
  40. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    The Known Issues page details .Net 4.6 issues:
    http://guavaman.com/projects/rewired/docs/KnownIssues.html

    I have not re-tested all these issues to see if Unity has fixed them in later versions of Unity. If and when I do, the documentation will be updated.
     
    Last edited: Oct 5, 2018
    NathanWarden likes this.
  41. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Okay, thanks :)
     
  42. misato

    misato

    Joined:
    Aug 5, 2012
    Posts:
    4
    So I'm working in a tutorial screen for my game. I'm using Rewired for the controls and my idea is to have the main character moving and doing an action automatically to explain what to do to the player. Is there any way to override the input for Rewired? So let's say my player character script has some Input.GetAxis and Input.GetButton and from another script I would do something like Input.SetButtonDown or something like that. Is that even possible? This is so I just reuse what I have built for the game but move the character programatically in the tutorial
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    Custom Controllers:
    http://guavaman.com/projects/rewired/docs/CustomControllers.html

    This is the only way you can inject your own input into the system.
     
  44. misato

    misato

    Joined:
    Aug 5, 2012
    Posts:
    4
  45. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    @guavaman

    There is a force feedback joystick from brunner. This is the same company that also has a force feed back yoke. It looks interesting with expected price point.

    https://www.brunner-innovation.swiss/product/cls-p-joystick/

    They also have a slightly cheaper option that you can attack a ThrustMaster Warthog grip to their system.

    = = = =

    There is also this company that has a research in progress for a new 6DoF joystick.

    They have a video of it being used in Overload (that is one of those games you mentioned that uses Rewired).

    http://www.sublightdynamics.com/games.php
     
    Last edited: Oct 14, 2018
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    These look like very cool devices. Thanks for sharing! I especially like the Sublight Dynamics joystick being used in Overload. That's very cool to have 6 DoF in a flight stick format! I could have used that back in my Descent deathmatch days...
     
  47. fluidImages

    fluidImages

    Joined:
    Sep 27, 2013
    Posts:
    29
    In the spirit of sharing - I was able to make a stand along Checkfor controllers (simplistic) that solved my problem...

    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3.  
    4. public class CheckJoystick : MonoBehaviour
    5. {
    6.  
    7.     public GameObject goTouchControl;
    8.     private bool connected = false;
    9.  
    10.     // Use this for initialization
    11.     void Start()
    12.     {
    13.         goTouchControl = GameObject.Find("Touch Control");
    14.  
    15.         #if MOBILE_INPUT
    16.                 goTouchControl.SetActive(true);
    17.         #else
    18.                 goTouchControl.SetActive(false);
    19.         #endif
    20.     }
    21.  
    22.     IEnumerator CheckForControllers()
    23.     {
    24.         while (true)
    25.         {
    26.             var controllers = Input.GetJoystickNames();
    27.             if (!connected && controllers.Length > 0)
    28.             {
    29.                 connected = true;
    30.                 goTouchControl.SetActive(false);
    31.                 Debug.Log("Connected");
    32.             }
    33.             else if (connected && controllers.Length == 0)
    34.             {
    35.                 connected = false;
    36.                 goTouchControl.SetActive(true);
    37.                 Debug.Log("Disconnected");
    38.             }
    39.             yield return new WaitForSeconds(1f);
    40.         }
    41.     }
    42.     void Awake()
    43.     {
    44.         StartCoroutine(CheckForControllers());
    45.     }
    46. }
    Although not directly related to rewired, it does work in conjunction for making a total single solution that shows and hides Touch controls that are for Mobile and desktop.

    Sean
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    I would change the check of Input.GetJoystickNames to ReInput.controllers.joystickCount. Input.GetJoystickNames is not accurate. Unity returns empty strings for joysticks that have been disconnected on many platforms including Android. Plus it generates garbage creating a string array every time you call it.

    Also, this technique doesn't match what you asked for in your question. Showing/hiding the touch controls when a joystick is connected is simple. But you had had asked how to show/hide them when someone touches anywhere on the screen, which is quite different because that would allow the user to use touch controls even if a joystick is currently connected by touching the screen. If that's your goal, I would combine the two techniques and show touch controls when no joystick is connected, but also hide them when a joystick receives any input (check ReInput.controllers.lastActiveController and see if it's a ControllerType.Joystick), and show them again when the screen is touched.
     
    Last edited: Oct 13, 2018
  49. Darkkingdom

    Darkkingdom

    Joined:
    Sep 2, 2014
    Posts:
    66
    Hey guavaman,

    I got a small problem with my joystick settings.
    I use GetAxis(), but after a few frames the value is already at max of -1 or 1.
    Is there a way to slow down the time, in which the input count up to the max values?

    Sorry I couldn't find an answer in your help section or the menus.

    Thank you very much!
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,878
    What kind of controller is this? I don't understand what you mean by "after a few frames the value is already...". Are you pressing a joystick to its full extents in a direction and expecting it to slowly go to -1 / +1? Or are you talking about a keyboard key / button using Digital Axis Simulation?