Search Unity

Rewired - Advanced Input for Unity

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

  1. max00007

    max00007

    Joined:
    Feb 13, 2016
    Posts:
    19
    Good morning everyone,

    short Update:
    - Target Platforms are Win & Android (maybe Apple someday).
    - Unity 2017.2.0f3
    - MadCatz C.R.T.L. Gamepad

    Edited this post 3 times now :D . What can I say: Override worked. Everything is fine. Finished 1 year of terribel work with the standard input manager in 36 hours using Rewired. Purchse on the way. Thank you very much :D

    Cheers
     
    Last edited: Jun 14, 2018
    guavaman likes this.
  2. MatthewWarcave

    MatthewWarcave

    Joined:
    Apr 13, 2018
    Posts:
    1
    Hi, I was wondering if there is a way to add modifier keys to the default mouse map. Like have an actions default key be "Shift + Left Mouse Button"?

    Thanks,
    Matthew
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    No. Controller Maps by definition exist per-device. They cannot bind anything across multiple devices.

    See How To's: Handling multi-Button Actions
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    Rewired 1.1.15.0 is now available for registered users to download. If you'd like to receive early access to updates, please contact me here. The update will appear on the Unity Asset Store when they approve it.

    Please see Updating Rewired before updating.

    Release Notes:

    1.1.15.0:

    Changes:
    - More properties on ActionElementMap can be modified directly.
    - Added "Activate Action Buttons on Negative Value" option the Rewired Editor.

    API Changes:
    - Added ActionElementMap.elementIdentifierId public setter.
    - Added ActionElementMap.actionId public setter.
    - Added ActionElementMap.axisRange public setter.
    - Added ActionElementMap.axisContribution public setter.
    - Added ActionElementMap.keyboardKeyCode public setter.
    - Added ActionElementMap.keyCode public setter.
    - Added ActionElementMap.modifierKey1 public setter.
    - Added ActionElementMap.modifierKey2 public setter.
    - Added ActionElementMap.modifierKey3 public setter.
    - Added ReInput.ConfigHelper.activateActionButtonsOnNegativeValue property.
    - Added TiltControl.SetRestOrientation method.

    New PlayMaker Actions:
    - RewiredGetControllerCount
    - RewiredConfigGetUseXInput
    - RewiredConfigSetUseXInput
    - RewiredConfigGetUpdateLoop
    - RewiredConfigSetUpdateLoop
    - RewiredConfigGetWindowsStandalonePrimaryInputSource
    - RewiredConfigSetWindowsStandalonePrimaryInputSource
    - RewiredConfigGetOSXStandalonePrimaryInputSource
    - RewiredConfigSetOSXStandalonePrimaryInputSource
    - RewiredConfigGetLinuxStandalonePrimaryInputSource
    - RewiredConfigSetLinuxStandalonePrimaryInputSource
    - RewiredConfigGetWindowsUWPPrimaryInputSource
    - RewiredConfigSetWindowsUWPPrimaryInputSource
    - RewiredConfigGetWindowsUWPSupportHIDDevices
    - RewiredConfigSetWindowsUWPSupportHIDDevices
    - RewiredConfigGetXboxOnePrimaryInputSource
    - RewiredConfigSetXboxOnePrimaryInputSource
    - RewiredConfigGetPS4PrimaryInputSource
    - RewiredConfigSetPS4PrimaryInputSource
    - RewiredConfigGetWebGLPrimaryInputSource
    - RewiredConfigSetWebGLPrimaryInputSource
    - RewiredConfigGetAlwaysUseUnityInput
    - RewiredConfigSetAlwaysUseUnityInput
    - RewiredConfigGetDisableNativeInput
    - RewiredConfigSetDisableNativeInput
    - RewiredConfigGetNativeMouseSupport
    - RewiredConfigSetNativeMouseSupport
    - RewiredConfigGetNativeKeyboardSupport
    - RewiredConfigSetNativeKeyboardSupport
    - RewiredConfigGetEnhancedDeviceSupport
    - RewiredConfigSetEnhancedDeviceSupport
    - RewiredConfigGetJoystickRefreshRate
    - RewiredConfigSetJoystickRefreshRate
    - RewiredConfigGetIgnoreInputWhenAppNotInFocus
    - RewiredConfigSetIgnoreInputWhenAppNotInFocus
    - RewiredConfigGetAndroidSupportUnknownGamepads
    - RewiredConfigSetAndroidSupportUnknownGamepads
    - RewiredConfigGetDefaultJoystickAxis2DDeadZoneType
    - RewiredConfigSetDefaultJoystickAxis2DDeadZoneType
    - RewiredConfigGetForce4WayHats
    - RewiredConfigSetForce4WayHats
    - RewiredConfigGetActivateActionButtonsOnNegativeValue
    - RewiredConfigSetActivateActionButtonsOnNegativeValue
    - RewiredConfigGetThrottleCalibrationMode
    - RewiredConfigSetThrottleCalibrationMode
    - RewiredConfigGetDeferControllerConnectedEventsOnStart
    - RewiredConfigSetDeferControllerConnectedEventsOnStart
    - RewiredConfigGetAutoAssignJoysticks
    - RewiredConfigSetAutoAssignJoysticks
    - RewiredConfigGetMaxJoysticksPerPlayer
    - RewiredConfigSetMaxJoysticksPerPlayer
    - RewiredConfigGetDistributeJoysticksEvenly
    - RewiredConfigSetDistributeJoysticksEvenly
    - RewiredConfigGetAssignJoysticksToPlayingPlayersOnly
    - RewiredConfigSetAssignJoysticksToPlayingPlayersOnly
    - RewiredConfigGetReassignJoystickToPreviousOwnerOnReconnect
    - RewiredConfigSetReassignJoystickToPreviousOwnerOnReconnect
    - RewiredConfigGetLogLevel
    - RewiredConfigSetLogLevel
    - RewiredActionElementMapSetActionId
    - RewiredActionElementMapSetElementIdentifierId
    - RewiredActionElementMapSetAxisRange
    - RewiredActionElementMapSetAxisContribution
    - RewiredActionElementMapSetKeyboardKeyCode
    - RewiredActionElementMapSetModifierKey1
    - RewiredActionElementMapSetModifierKey2
    - RewiredActionElementMapSetModifierKey3
    - RewiredActionElementMapSetKeyCode
    - RewiredActionElementMapGetActionDescriptiveName
    - RewiredControllerImpelementsTemplate

    New Behavior Designer Tasks:
    - RewiredGetControllerCount
    - RewiredConfigGetUseXInput
    - RewiredConfigSetUseXInput
    - RewiredConfigGetUpdateLoop
    - RewiredConfigSetUpdateLoop
    - RewiredConfigGetWindowsStandalonePrimaryInputSource
    - RewiredConfigSetWindowsStandalonePrimaryInputSource
    - RewiredConfigGetOSXStandalonePrimaryInputSource
    - RewiredConfigSetOSXStandalonePrimaryInputSource
    - RewiredConfigGetLinuxStandalonePrimaryInputSource
    - RewiredConfigSetLinuxStandalonePrimaryInputSource
    - RewiredConfigGetWindowsUWPPrimaryInputSource
    - RewiredConfigSetWindowsUWPPrimaryInputSource
    - RewiredConfigGetWindowsUWPSupportHIDDevices
    - RewiredConfigSetWindowsUWPSupportHIDDevices
    - RewiredConfigGetXboxOnePrimaryInputSource
    - RewiredConfigSetXboxOnePrimaryInputSource
    - RewiredConfigGetPS4PrimaryInputSource
    - RewiredConfigSetPS4PrimaryInputSource
    - RewiredConfigGetWebGLPrimaryInputSource
    - RewiredConfigSetWebGLPrimaryInputSource
    - RewiredConfigGetAlwaysUseUnityInput
    - RewiredConfigSetAlwaysUseUnityInput
    - RewiredConfigGetDisableNativeInput
    - RewiredConfigSetDisableNativeInput
    - RewiredConfigGetNativeMouseSupport
    - RewiredConfigSetNativeMouseSupport
    - RewiredConfigGetNativeKeyboardSupport
    - RewiredConfigSetNativeKeyboardSupport
    - RewiredConfigGetEnhancedDeviceSupport
    - RewiredConfigSetEnhancedDeviceSupport
    - RewiredConfigGetJoystickRefreshRate
    - RewiredConfigSetJoystickRefreshRate
    - RewiredConfigGetIgnoreInputWhenAppNotInFocus
    - RewiredConfigSetIgnoreInputWhenAppNotInFocus
    - RewiredConfigGetAndroidSupportUnknownGamepads
    - RewiredConfigSetAndroidSupportUnknownGamepads
    - RewiredConfigGetDefaultJoystickAxis2DDeadZoneType
    - RewiredConfigSetDefaultJoystickAxis2DDeadZoneType
    - RewiredConfigGetForce4WayHats
    - RewiredConfigSetForce4WayHats
    - RewiredConfigGetActivateActionButtonsOnNegativeValue
    - RewiredConfigSetActivateActionButtonsOnNegativeValue
    - RewiredConfigGetThrottleCalibrationMode
    - RewiredConfigSetThrottleCalibrationMode
    - RewiredConfigGetDeferControllerConnectedEventsOnStart
    - RewiredConfigSetDeferControllerConnectedEventsOnStart
    - RewiredConfigGetAutoAssignJoysticks
    - RewiredConfigSetAutoAssignJoysticks
    - RewiredConfigGetMaxJoysticksPerPlayer
    - RewiredConfigSetMaxJoysticksPerPlayer
    - RewiredConfigGetDistributeJoysticksEvenly
    - RewiredConfigSetDistributeJoysticksEvenly
    - RewiredConfigGetAssignJoysticksToPlayingPlayersOnly
    - RewiredConfigSetAssignJoysticksToPlayingPlayersOnly
    - RewiredConfigGetReassignJoystickToPreviousOwnerOnReconnect
    - RewiredConfigSetReassignJoystickToPreviousOwnerOnReconnect
    - RewiredConfigGetLogLevel
    - RewiredConfigSetLogLevel
    - RewiredActionElementMapSetActionId
    - RewiredActionElementMapSetElementIdentifierId
    - RewiredActionElementMapSetAxisRange
    - RewiredActionElementMapSetAxisContribution
    - RewiredActionElementMapSetKeyboardKeyCode
    - RewiredActionElementMapSetModifierKey1
    - RewiredActionElementMapSetModifierKey2
    - RewiredActionElementMapSetModifierKey3
    - RewiredActionElementMapSetKeyCode
    - RewiredActionElementMapGetActionDescriptiveName
    - RewiredControllerImpelementsTemplate

    Bug Fixes:
    - Fixed exception thrown when a Touch/Tilt control is created while no GameObject is selected and no TouchController or CustomController component exists in the scene.
    - Fixed extremely rare ObjectDisposedException thrown in a build when application exits on Windows Standalone + Raw Input / Direct Input.
    - UnityInputOverride now returns true when an Action's value is negative to be consistent with how UnityEngine.Input.GetButton functions work.
     
  5. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    239
    Hello!

    With your most recent update, you added a public setter to "elementIdentifierId". Will this mean you can use that for quick remapping or should it be done some other way? I'm currently trying to make a remapping system that does not use the standard XML solution provided and I'm getting stuck on the assigning keys again part.

    Also, how can I make it so the input mapper can check for conflicts in only one category? Right now, when I have conflict checking on, it detected a conflict in my "UI" category and removed the buttons for the UI navigation.

    Thanks
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    It depends. The reason why these properties were not exposed in the first place is that there is a lot of information baked into the ActionElementMap from the target device to prevent having to do expensive lookups all the time. This information is baked when the Controller Map is loaded in the Player. Certain information can be changed through the new properties because references to the Controller, Player, Controller Map, etc. are stored in the Controller Map. Changing some of these properties will cause unexpected side effects such as changing the Element Identifier Id. You change that from a Button element identifier to an Axis element identifier and the parent Controller Map has to move the Action Element Map to another list which will cause exceptions if you're currently iterating the list at that time. The purpose is to make changing certain information in the binding quicker, yes.

    Refer to the examples included with Rewired on how to do rebinding:
    ControlRemapping1
    Control Mapper
    Simple Control Remapping

    Full source code is provided for all 3 examples.

    You can create new bindings from scratch in the Controller Map from your saved data with ControllerMap.CreateElementMap.

    See Conflict Checking. Conflict checking settings are managed in the Rewired Editor and are per-Map Category, so you can set which categories conflict check with other categories. You can also see exactly that conflict checking scenario shown in the Control Mapper Demo example scene in Rewired/Extras/ControlMapper/Examples.
     
    Last edited: Jun 17, 2018
    RealMTG likes this.
  7. danbrani

    danbrani

    Joined:
    Nov 22, 2012
    Posts:
    45
    Is there some limitation regarding putting that in or is this a design decision? I need to take a stab at this soon, so any info you could share would be greatly appreciated!
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    Both. You can't make Rewired run in edit mode.

    It was never planned for in the beginning. Rewired does not serialize its runtime objects or states. This would be required in order to have all the various objects, assignments, mappings, etc. maintained between edit mode and Play mode. Serializing these objects is incredibly problematic due to the use of events, delegates, custom collections, other not-serializable classes, and reciprocal references in objects to non-UnityEngine.Object-based classes. Everything would have to be serialized from the top down all the way to all the native input libraries on every platform. It would also be extremely problematic to edit Rewired's Player, Controller Maps, Actions, etc. while the system is running. Any edits to those would require a complete reinitialization of the system because it wasn't designed to allow runtime modification to those objects.

    If the state didn't have to be maintained between Edit and Play mode and everything could be reinitialized on mode change, it wouldn't that be a big an issue, but I don't think most users would be happy with that limitation.
     
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
  10. danbrani

    danbrani

    Joined:
    Nov 22, 2012
    Posts:
    45
    Thanks, I don't mind reinitialization on play mode start, so it seems to be worth a shot, I have some systems that work both in edit and play mode, and maintaining consistency there would be great.
     
  11. danbrani

    danbrani

    Joined:
    Nov 22, 2012
    Posts:
    45
    It looks like it'd be a lot of trouble for me to cook something up because the code I'd need to change is locked behind dlls.
    Can you make this possible?
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    I told you above that you can't make Rewired run in Edit mode. It's not going to be simply adding Execute in Edit mode to the main MonoBehavior. There are many things across many systems that have to be changed to make it work even if it just reinitializes. There are so many vectors for errors and crashes, especially with the native input which has to be shut down correctly as you manipulate the current Rewired Input Manager you're using in the scene live, and a whole lot more. All the editor code has to be changed to somehow allow and/or be aware of this as editing the Actions, Players, etc. live will undoubtedly cause immediate exceptions. I will have to look into this as a feature request.
     
    Last edited: Jun 19, 2018
    danbrani likes this.
  13. BuckeyeStudios

    BuckeyeStudios

    Joined:
    Oct 24, 2013
    Posts:
    104
    Has anybody used Rewired for Realistic Car Controller?
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
  15. Dustin88

    Dustin88

    Joined:
    Jun 4, 2014
    Posts:
    10
    Ok no problem if i rewrite there input script can I post it on here for others to use. Or do you have a website with a integration section.
     
  16. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,451
    Since the author of Realistic Car Controller has other assets that support Rewired (e.g. Tank Controller - http://www.bonecrackergames.com/realistic-tank-controller). It should not be that hard to add Rewired to Realistic Car Contoller.
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    I'm not really sure what you're saying.

    1. What input script would you write that would make Rewired run in Edit mode?
    2. Rewired's integrations are listed in the documentation: http://guavaman.com/projects/rewired/docs/Integration.html

    I've spent all day trying to determine how much has to be done to make it run in edit mode. I will let you know if I hit any major roadblocks.
     
  18. unity_UMTQeX6S-DU-LA

    unity_UMTQeX6S-DU-LA

    Joined:
    May 21, 2018
    Posts:
    2
    Love the asset, its really streamlined my time and has been a pleasure to work with.

    Is it going to be updated to support the 2018.2.0x-ImprovedPrefabs preview or just sticking with stable content?
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    Thanks!

    I don't support beta features or versions of Unity. I have no plans on adding anything with regards to the new prefab workflow at this time. I don't even see what the benefit would be or know what I would have to do to support it.
     
  20. unity_UMTQeX6S-DU-LA

    unity_UMTQeX6S-DU-LA

    Joined:
    May 21, 2018
    Posts:
    2
    Understood, thank you for the very fast response.
     
  21. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    149
    Is there a standalone page for document downloads like http://guavaman.com/rewired/files/docs/RewiredControllerElementIdentifiersCSV.zip or do I have to scan through various FAQ or best practices pages to find the links?

    I found four different CSV files while reading a page in the past, but I can't recall which it was. Also, I'm not sure if there are additional files and other versions, for example, one for 1.1.15.0.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    No, there is no page that lists all downloads. Those 4 CSV files are the only files available and they are linked on the How To's page.

    http://guavaman.com/projects/rewired/docs/HowTos.html#display-glyph-for-action
    http://guavaman.com/projects/rewired/docs/HowTos.html#identifying-recognized-controllers

    There are no version-specific versions of these files. They are updated to include the latest controllers when they are added.
     
  23. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,203
    We're thinking of upgrading a project from 2017.2 to 2018.1. Currently we're on an old version of Rewired 1.1.10.0.U2017. Do you have a suggested upgrade path? Should we upgrade to 1.1.15.0 first and then upgrade to U2018.1 or is there more appropriate upgrade path which keeps all our current settings?

    Do you have any known issues with 1.1.15 and 2018.1 or anything we need to be aware of during the upgrade?
     
  24. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,451
    I think you should upgrade to Rewired 1.1.15.0 first and then later upgrade Unity to 2018.1. It is only in Rewired 1.1.13.0 or later that Unity 2018 branch is even supported.

    Rewired 1.1.13.0:

    Changes:
    - Added Unity 2018 branch.

    It probably depends on what type of game you have. If you are using flight controllers there is a change to how the throttles are handled in Rewired 1.1.11.0:

    Added Throttle Calibration Mode option to switch default throttle calibration between 0-1 output range and -1 to +1 output range. So the default is now 0-1 for all throttles which makes them consistent. But you can change that mode to -1 to +1 if you prefer. More details are in the release notes on 1.1.11.0 on all the controllers that were modified.
     
    Last edited: Jun 21, 2018
  25. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    71
    Hello Augie,

    I just wanted to say that rewired don't work with Unity 2018.2 with the new prefab system!

    here is the error that I have:

    Code (CSharp):
    1. Rewired: Data files not found!
    2. ------- Rewired System Info -------
    3. Unity version: 2018.2.0x-ImprovedPrefabs
    4. Rewired version: 1.1.15.0.U2018
    5. Platform: Unknown
    6. Using Unity input: False
    7.  
    8. UnityEngine.Logger:LogError(String, Object)
    9. Rewired.Logger:LogErrorNow(Object, Boolean)
    10. Rewired.Logger:LogError(Object, Boolean)
    11. Rewired.Logger:LogError(Object)
    12. Rewired.Editor.InputEditor:‭‮‮‪‎‮‫‍‭‌‍‬‮‪‫‫‌‮‏
‍‫‮‮
‬‮(Object)
    13. Rewired.Editor.InputEditor:Initialize(InputManager_Base, Boolean)
    14. Rewired.Editor.InputEditor:‏‌
‌‭‬‮‏

‫
‏‭‮‮‎‪‪‌‫‬‮(InputEditor, InputManager_Base, Boolean)
    15. Rewired.Editor.InputEditor:UpdateUnitySelection()
    16. Rewired.Editor.InputEditor:OnSelectionChange()
    17. UnityEditor.HostView:OnSelectionChange()
    18.  

    Code (CSharp):
    1. ArgumentException: failed to convert parameters
    2. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:192)
    3. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    4. hOhaHfifWIlSodZWdioWsXooMnFr+dnBdqKTGenfxdlyIcvjzhVFMjSO.‮‍

‫‭‬‍
‌
‮‭‪‍‫‌‍‏‪‭‫‌‍‍‮‌
‮ (System.Reflection.MethodBase , System.Object , System.Object[] )
    5. hOhaHfifWIlSodZWdioWsXooMnFr+dnBdqKTGenfxdlyIcvjzhVFMjSO.nGiWjqAuVkZtJBSoEykBhFwUucB (UnityEngine.Object )
    6. Rewired.Editor.InputManagerInspector_Internal.‮‌‍‍‬‭‌

‏‭‏‪‪‪‭‍‫‭‪‮ (UnityEngine.Object )
    7. Rewired.Editor.InputManagerInspector_Internal.OnInspectorGUI ()
    8. Rewired.Editor.CustomInspector_External.OnInspectorGUI () (at Assets/Rewired/Internal/Scripts/Editor/CustomInspectors/CustomInspector_External.cs:19)
    9. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1454)
    10. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    11.  
    Code (CSharp):
    1. ArgumentException: failed to convert parameters
    2. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:192)
    3. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    4. hOhaHfifWIlSodZWdioWsXooMnFr+dnBdqKTGenfxdlyIcvjzhVFMjSO.‮‍

‫‭‬‍
‌
‮‭‪‍‫‌‍‏‪‭‫‌‍‍‮‌
‮ (System.Reflection.MethodBase , System.Object , System.Object[] )
    5. hOhaHfifWIlSodZWdioWsXooMnFr+dnBdqKTGenfxdlyIcvjzhVFMjSO.nGiWjqAuVkZtJBSoEykBhFwUucB (UnityEngine.Object )
    6. Rewired.Editor.InputEditor.‍‫‭‬‍‏‎‬‎‮‎
‫‌‏‏‫‏‫‫‪‫‍‍‍‬‫‮ (UnityEngine.Object )
    7. Rewired.Editor.InputEditor.OnGUI ()
    8. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    9. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    10. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    11. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    12. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    13. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    14. UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
    15. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    16.  
    @guavaman
     
  26. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    Hey @guavaman

    I was looking to modify your custom control mapper code. At the moment, you can keep toggling left / or right on the custom controls screen until you have no element selected. I was hoping to cap or wrap the next selection object so that it doesn't allow the player to select nothing? I assume its somehow modifying the FindSelectableOnRight() code?

    Any help would be appreciated.

    Tom.

    EDIT: I've realised its the scroll bar. Is there a way to remove this if it isn't needed?
     
    Last edited: Jun 21, 2018
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    Upgrade Unity first, then Rewired. There's separate branches of Rewired for each major version of Unity. Downloading the new version before upgrading Unity will get you the 2017 version of Rewired which you'll have to upgrade again.

    See Updating Rewired first.

    All known issues are listed on the Known Issues page.
     
    sstrong likes this.
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    I do not support beta features or beta versions of Unity. Obviously I'm going to have to go rework the editor code for this brand new feature of Unity. I wouldn't be surprised if there are a bunch of bugs in the new system also causing this problem because the exception shown should be quite literally impossible to get based on the code.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    The scroll bar is not displayed if the number of Actions listed fits on the screen.
     
  30. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    That isn't true for my mapper screen. But I have disabled some parts.
    control_mapper.jpg
     
  31. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    71
    Sure, I'm not asking you to support it :)
    It's just that I wanted to warn you about it

    Edit: It work on unity 2018.2 beta, but not on the one with the new prefabs
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    Thanks for the heads up.

    So I found out what was causing the "ArgumentException: failed to convert parameters" exception. They changed the method signature of PrefabUtility.GetCorrespondingObjectFromSource to be a generic method, therefore causing the call by reflection to fail. The only reason I'm calling this by reflection is because they deprecated PrefabUtility.GetPrefabParent in 2018.2 beta and replaced it with the new PrefabUtility.GetCorrespondingObjectFromSource. If I leave calls to PrefabUtility.GetPrefabParent in the DLL, Unity will flag it as needing to be upgraded by their API updater. I do not want to have to publish a new branch of Rewired just for 2018.2 because of this change because it just takes far too much effort and time to deal with building, testing, and uploading that many branches of Rewired every time I make an update. So I put in place this reflection system to make it so I don't have to. This was done to support Unity 2018.2 beta so it wouldn't trigger the API updater. This method signature has changed with this new prefab system version. Now I'm going to have to detect and support both the old signature and the new signature. This is a perfect example why I don't support beta versions of Unity.
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    FYI this is not the only problem with 2018.2.0x-ImprovedPrefabs... The included Control Mapper examples are now broken (and probably a lot of other stuff I haven't discovered yet). The examples use a prefab of Control Mapper in the project. Every object reference on these prefabs are now broken. These are nothing but bog standard Unity prefabs that have been unmodified. This is clearly a major bug in the new system and will be reported to Unity.

    Edit: This is one of those nasty -- it only does it the first time something is imported in the editor session bugs. Subsequent imports work. Deleting Control Mapper, exiting the editor, then reinstalling it on the next session causes broken references again.
     
    Last edited: Jun 21, 2018
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    Another problem because of the constantly changing Unity UI. Works perfectly in 4.7 and 5.0. Doesn't work anymore in 5.2+. Reason: They added a scrollbar visibility option which fires in LateUpdate and overrides my own scrollbar visibility handling. The option defaults to Permanent meaning the scroll bar is always visible. Every time I disable the scroll bar, the ScrollRect component then re-enables it at the end of the frame.

    Control Mapper is not branched for each version of Unity. There is one code base and one Zip file containing all the prefabs, scripts, etc. The only way I'm going to be able to make this work is to add Unity version-specific runtime code to set the property on the ScrollRect to AutoHide. You can do so yourself on the ScrollRect inspector in your Control Mapper because you're only concerned with your current version of Unity.
     
    Last edited: Jun 21, 2018
    IceBeamGames likes this.
  35. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,203
    In Landscape Builder, we added the following code to get round this issue. Not sure if this helps when using a DLL or not.

    Code (CSharp):
    1. #if UNITY_2018_2_OR_NEWER
    2. GameObject prefabSource = (GameObject)UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(newPrefab.gameObject);
    3. #else
    4. GameObject prefabSource = (GameObject)UnityEditor.PrefabUtility.GetPrefabParent(newPrefab.gameObject);
    5. #endif
     
  36. Sendatsu_Yoshimitsu

    Sendatsu_Yoshimitsu

    Joined:
    May 19, 2014
    Posts:
    666
    I'm getting an error every time I run the game, "Rewired: Failed to open HID device for reading. This device (Unknown) may not function". It's caused by my weird controller setup (running a dualshock 4 via DS4Windows) and completely harmless, no actual behavior is impacted. But is there any chance that I can dump a #pragma somewhere to keep the error from being displayed? I'm assuming it's not possible, but it'd be nice to de-clutter my console a bit. ^^
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    Unfortunately, you can't do this in a DLL which is why I'm using the reflection method. It's essentially the same, but when reflecting, it matters if the method is generic or not. It wasn't generic in the 2018.2 beta version I changed the code to support, but it is in Unity 2018.2.0x-ImprovedPrefabs, which is the cause of the issue.
     
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    No. There is no option to disable that message or any other warning or log message individually, as there isn't in Unity. The only thing you can do is disable logging entirely: http://guavaman.com/projects/rewired/docs/RewiredEditor.html#Settings
     
  39. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,203
    Yeah, we use reflection for some of our integration work but it is super fragile due to similar issues. Unity (and others) have a habit of renaming stuff or moving that functionality to another class or assembly...
     
  40. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    Thank you, that sorted it.

    One final question. Is there a way of preventing people assigning buttons to full axis input fields. Also, is there a way of listing "Look Left" before "Look Right" on the split axis assignments? No worries if not, just a minor bit of polish.
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    No. All options available are shown in the inspector. If the option isn't there, the only way to change it is to change the source code. That would probably be a better order to list them in now that you mention it. Edit: That would mess up Up/Down. Nevermind.
     
    IceBeamGames likes this.
  42. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    The only way to change buttons being assigned to axis is to change the control mapper.cs code, you mean?

    Can you tell me where to look?

    EDIT: I changed IsAllowedAssignment to always return false if the pollingInfo.elementType == ControllerElementType.Button. Is that safe enough?
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    I didn't even see your first question. I was answering your second.

    Why would you want to prevent them from assigning buttons to full-axis fields? It already moves the assignment to the positive field if they try to do that.
     
  44. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    Its because I am having to localise split axis with the correct console terminology and the localisation changes I made to the control mapper are failing when you assign a button to a full axis. Its coming up blank, and this seemed an easier fix.
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    That probably means you are using the positive name and negative name of the element identifier when writing the element name on a split axis. Button elements don't have positive descriptive and negative descriptive names, so just use the descriptive name in that case. That's what Control Mapper does.
     
  46. IceBeamGames

    IceBeamGames

    Joined:
    Feb 9, 2014
    Posts:
    116
    No, it isn't, I don't think. When I assign a button to an axis the button remains assigned to its previous assignment and the new axis assignment entry becomes blank. I don't even get a request to get the localised term from the entry. It might be that custom "swap" code I put in? Not sure.
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,835
    It's definitely not the behavior of the default Control Mapper, so yes, I would say it has something to do with the changes you made. The current version of Control Mapper has swapping code. You can test it and see how it behaves.
     
  48. Sendatsu_Yoshimitsu

    Sendatsu_Yoshimitsu

    Joined:
    May 19, 2014
    Posts:
    666
  49. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    149
    Thanks! I ended up writing an editor tool to pull some data out of the maps referenced in the ControllerDataFiles asset to create quick lookup tables. So if anything changes in the future, I can just run the tool.

    When setting up sprites for various controllers, I came across the Logitect Dual Action hardware map and noticed that the four bumper buttons are called "LeftShoulder1", "LeftShoulder2", "RightShoulder1", and "RightShoulder2", however when reviewing photos of the actual controller, the buttons are clearly labeled 5, 6, 7, and 8.

    Do you know which buttons are "Shoulder1" and "Shoulder2"? I don't have this controller, and can't tell if the "Shoulder1" buttons are 5 and 6 or 7 and 8. Does anyone have this controller to get that information?
     
  50. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    251
    I have all my GUI setup and working fine supporting iOS, keyboard or joysticks.

    I have a touchpad setup to look around and working fine on touch screen mode but with the joystick the sensitivity is too low.

    I have an Input Behavior set but changing the sensitivity in there seem to be affecting the touch input but not the joystick. Any tips on what can be my problem ?

    thx in advance