Skip to content

Releases: hiloqo/Hinput

v3.0: Some minor API improvements

28 May 21:34
Compare
Choose a tag to compare

Breaking

  • Change the name/fullname paradigm
    These two features were used partly for internal input polling, and partly for debugging purposes. I have decided to make them clearer.

    • fullname has been completely removed from Gamepad, Pressable and Stick.
    • name now behaves similarly to how fullname used to be, minus the name of the OS at the beginning. For instance, on Pressable "A" is now "Gamepad0_A" and on Stick "leftStick" is now "Gamepad0_leftStick". On gamepad, name still returns the same result.
  • xboxButton feature of Gamepad has been removed
    This button was only functional on MacOS and was seeing very little use.

Fixes

  • Fixed a bug causing the example scene to not render properly with 3+ connected controllers

General

  • Updater is now instanciated as a child of the Settings object, instead of on the same GameObject

  • Add a selector for which gamepad to vibrate in the Debug Scene

  • Reword some of the comments and document to make the overall tone more professional

  • Remove my personal info in a few places where it remained, and replace it with the official Hinput email address

v2.0 : Hinput 2.0

12 May 14:41
Compare
Choose a tag to compare

This version consists of a significant amount of breaking changes to the API. Hopefully, they will make it more consistent, efficient and easy to use for you. Have a look at this guide if you need help adapting your code to the new API.

Breaking - Changes

  • Rename hinput to Hinput
    I added a capital H to better comply with C# best practices.

  • Remove the “h” prefix before the name of all classes
    hGamepad is now Gamepad, hButton is now Button and so on.

  • Add dedicated namespaces to prevent collision in class names
    This is meant to prevent collisions between user classes and Hinput classes, since they have much more common names without the "h" prefix.

    • "HinputClasses" for Gamepad, Stick, Pressable, Button, Trigger, StickDirection, StickPressedZone, Press, VibrationPreset and Settings
    • "HinputClasses.Internal" for the rest
    • The Hinput class is not part of a namespace, and can still be accessed from anywhere.
  • Change AnyGamepad and AnyInput paradigm
    I reduced consistency a bit, in favor of a much simpler and intuitive system.

    • Remove "internal" properties
    • Remove exclusive AnyGamepad, AnyInput and AnyGamepadStick properties
    • index, leftVibration and rightVibration are always -1
    • name, fullName and type are always “AnyGamepad” or “AnyInput”
    • On AnyGamepad, isEnabled, Enable and Disable only impact AnyGamepad. Same for AnyInput.
    • On AnyGamepad, isConnected returns true if at least one gamepad is connected
    • On AnyGamepad, Vibrate vibrates all gamepads
  • Rename Direction to StickDirection

  • Rename parameters from Settings for clarity

    • directionAngle is now stickType. It is an enum which values are Four Directions (previously directionAngle = 90) and Eight Directions (previously directionangle = 45)
    • rename vibrationDuration to vibrationDefaultDuration, leftVibrationIntensity to vibrationDefaultLeftIntensity and rightVibrationIntensity to vibrationDefaultRightIntensity
    • Default vibration is now VibrationPreset.Impact (left 20%, right 80% for 0.2 seconds).

Breaking - Removed features

  • Remove "internal" properties
    These properties were not clear at all, and provided very little use.

    • Gamepad: remove internalName, internalFullName, and internalIndex
    • Pressable: remove internalName, internalFullName, internalGamepad, internalGamepadFullName, internalGamepadIndex
    • Button, AnyInput and Trigger: remove internalIndex
    • StickDirection, StickPressedZone: remove internalStickFullName, internalStick, stickIndex, stickFullName (the latter two can still be accessed through stick.index and stick.fullName)
    • Stick: remove internalFullName, internalGamepad, internalGamepadIndex, internalGamepadFullName, gamepadIndex, gamepadFullName (the latter two can still be accessed through gamepad.index and gamepad.fullName)
  • Remove exclusive properties from AnyGamepad and AnyInput

    • AnyGamepad: remove gamepads, gamepad, indices
    • AnyInput: remove pressedInputs, pressedInput, index
    • AnyGamepadStick: remove pressedSticks, pressedStick
  • Remove buildAllOnStartup from Settings

    • I reworked the whole performance system, and this feature was not needed anymore.
  • Remove "raw" properties and inDeadZone
    Because no one needs that stuff when you can change the size of dead zones (you can even do it through code)

    • Pressable: remove inDeadZone, positionRaw
    • Stick: remove inDeadZone, positionRaw, horizontalRaw, verticalRaw, angleRaw, distanceRaw, worldPositionCameraRaw, worldPositionFlatRaw
  • Remove redundant directions from Stick

    • Remove leftUp, rightUp, leftDown, rightDown from stick (upLeft, upRight, downLeft, and downRight still exist and do exactly the same thing)
  • Remove position from Pressable
    Position is not a relevant information on buttons that can only be pressed or released. This property is still present on Trigger.

  • Remove lastPress properties from Pressable
    These properties are not very useful, and easy to reproduce if needed by the user.

    • Remove lastPressWasDouble, lastPressWasLong, lastPressed, lastPressStart and lastReleased from Pressable
  • Remove doublePress and longPress properties from Pressable
    I changed how Pressable works and added Press properties instead.

    • Remove doublePress, doublePressJustPressed, doublePressJustReleased, longPress, longPressJustPressed and longPressJustReleased from Pressable
  • Remove angle from StickDirection

  • Remove Stick => Pressable implicit conversion (through inPressedZone)

Features

  • Add Press class to represent a specific way of pressing a Pressable (for instance a simple, double or long press)

    • The Press class has the following properties: pressed, justPressed, released, justReleased, pressDuration, releaseDuration.
    • Add simplePress, doublePress and longPress properties to Pressable
  • Add implicit conversions

    • Pressable => Press through simplePress by default
    • Press => bool through pressed by default
    • Pressable => bool through simplePress.pressed by default
  • Add settings to choose default conversions

    • Pressable => Press can use either simplePress, doublePress or longPress (default is simplePress).
    • Press => bool can use either pressed, justPressed, released or justReleased (default is pressed).
  • Rework performance management
    In most cases, Update time is about 20% of what it used to be.

    • Add Enable and Disable methods to Gamepads, Pressables and Stick, as well as isEnabled property.
    • Add settings to start the game with any Gamepad, Pressable or Stick already disabled.
    • Skip update in disabled Gamepads, Pressables and Sticks.
    • Skip update in Gamepads that have never been connected.
    • Make D-pads much more efficient.
    • Make Axes much more efficient.
    • Make Buttons a bit more efficient.
    • Remove 1 frame latency on AnyGamepad
  • Improve OS detection to support XBoxOne and non-Windows WebGL builds

Fixes

  • Buttons on AnyGamepad now behave like normal buttons
    They're considered pressed if they are pressed on at least one gamepad, and released if they are released on all gamepads. If a given button is pressed on a gamepad, releasing it on a different gamepad no longer triggers a justReleased event on AnyGamepad.

  • Move the Updater script earlier in execution order
    This fixes various minor bugs caused by Hinput not being updated consistently

  • Add a few checks at potential divisions by 0
    For instance if dead zone = 1

General

  • Add internal classes StickPressable, GamepadPressable and AnyGamepadButton

  • Countless code refactorings, project improvements, comment rephrasing and document edits

v1.6.1 Post-definitive version

24 Apr 17:41
Compare
Choose a tag to compare

fixes:

  • Fixed a typo in the uninstall message

  • Added a prompt to connect a controller in the example scene when needed

  • Fixed inconsistent case in the name of a doc file

v1.6.0 : Definitive version - Test scenes, vibration presets

22 Apr 17:36
Compare
Choose a tag to compare

features:

  • Example scene
    A simple visual interface that can be used to test gamepads and learn hinput commands.

  • Debug scene
    Makes debugging easier by testing every feature of the plugin and logging them to the console.

  • Vibration presets
    A new overload of the "Vibrate" method on gamepads makes it possible to use a ready-made list of vibration presets, stored in the "hVibrationPreset" enum. Additional overloads allow for changes in the duration and intensity of the chosen preset.

  • Vibration Curves
    A new overload of the "Vibrate" method on gamepads makes it possible to use either one or two Unity Animation Curves as input for a vibration pattern. These curves are editable in the Unity editor with a very simple interface.

  • Progressive StopVibration
    A new overload of the "StopVibration" method on gamepads adds a float argument to it, allowing for a progressive stop of all current vibrations over a chosen number of seconds.

  • leftVibration and rightVibration property of gamepads
    These two new properties of hGamepad return the current intensity at which that gamepad's motors are vibrating, making coordinating different vibration patterns easier.

  • isConnected property of gamepads
    This boolean returns true is a hGameapd is currently connected, false if it's not.

fixes:

  • Fixed out of range error when calling gamepad type
    Requesting the "type" property of hGamepads with a high index in the "gamepad" array of hinput no longer has a chance of returning an error.

  • Better error handling in setup script
    If something goes wrong in the setup phase, hinput will now log a warning in the console instead of displaying a success message no matter what.

  • "Set up hinput" menu option now correctly greys out if the plugin has been installed
    This bug was introduced by a typo in a recent update.

  • Fix typos
    Additional confusions between "setup" and "set up", and small errors in comments.

general:

  • Add ".txt" extension to license file
    Some operating systems struggle with extension-less files.

  • Add license info in README
    I'm no lawyer, but I tried to summarize the MIT license at the bottom of my README page (with a reference to the actual file).

  • General refactoring
    Replace unnecessary for loops and double values, add consistency in code and precision in comments.

v1.5.1 : Fixing FixedUpdate

07 Apr 09:32
Compare
Choose a tag to compare

fix

  • hinput now uses frame count instead of unscaled time to determine whether it is up to date - Thanks to Jon for suggesting this fix
    Since frame count is not affected by FixedUpdates (unlike unscaled time), this fixes a bug causing hinput to not be refreshed in Update if it was called in FixedUpdate. Also, storing integers instead of floats slightly improves performance.

v1.5.0 : March 2020 release - Support for Unity 2019.3 and beyond !

28 Mar 18:08
Compare
Choose a tag to compare

features:

  • hinput can now be set up correctly on Unity versions 2019.3 and later
    Many people requested this, and I finally found a way to dump hundreds of controls into the new input manager. Note that in some versions of Unity you will need to manually reimport your asset database after setting up hinput.

fixes:

  • Fixed a bug where XInput would sometimes cause conflicts in WebGL builds

  • Fixed a typo causing hinput to not be correctly set up in case-sensitive OSes

  • Set the proper range for triggers on Linux
    I had read somewhere that gamepad drivers on Linux returned values between -1 and 1 for triggers, so I lerped it back to the [0,1] range. But that info was wrong and the data was already in [0,1], so I was actually lerping it into the [0.5,1] range.

  • Renamed the menu option from "Setup hinput" to "Set up hinput"
    Apparently "setup" is a noun, while "set up" is a verb. The more you know.

general:

  • Switched the working project to the definitive version 2019.1 of Unity

  • Lightly refactored the testing script to support older versions of Unity

v1.4.0 : December release - Id of anyGamepad & anyInput

09 Dec 13:02
Compare
Choose a tag to compare

features:

  • anyGamepad and anyInput will now pretend to be the current pressed gamepad/input.
    For instance, if you pressed a button on gamepad 2, hinput.anyGamepad.index will return 2. This works with many other properties, such as name, fullName and gamepad. To access the true values of these properties add "internal" in front of their name e.g. internalIndex, internalFullName..

  • Global anyInput
    Calling hinput.anyInput will now return a virtual button that is considered pressed if anything is pressed. This is similar to hinput.anyGamepad.anyInput.

  • Uninstall hinput
    It is now possible to uninstall hinput the same way you install it (tools > hinput > uninstall hinput). This will clear all hinput entries from your inputManager, but hinput files will remain.

fixes:

  • Buttons and triggers won't be considered justReleased on the first frame anymore.

  • Un-invert D-Pads on Mac
    This fixes an exotic bug introduced in v1.3.0 that caused up/down and left/right directions of the D-Pad to be inverted, exclusively on Mac.

  • Support for opposite directions on D-Pads
    I don't know how you would do that, but pressing up now cancels pressing down on a D-Pad, and vice-versa.

v1.3.0 : November release - anyInput, gamepad types, and more !

03 Nov 22:03
Compare
Choose a tag to compare

features:

  • Gamepad type
    Gamepads now have a "type" field that will tell you what kind of controller you are holding (Xbox, PS4..)

  • inPressedZone property of stick is now a hPressable
    This property of sticks, telling you whether they are pushed, switched from being a regular boolean value to a full-fledged button. That means you can access every feature of hPressable, from "justPressed" to long and double presses. You can also write "hinput.gamepad[0].leftStick" to know if it is being pushed in any direction.

  • Button list in gamepads
    I added a property called "buttons" to gamepads. It's a list of every button, trigger, bumper and stick click of the gamepad. Each of those buttons also has an "index" property that will return its index in this list. This feature is meant to complement the "sticks" property, so that you can iterate on every input of the gamepads.

  • anyInput in gamepads
    You can now listen to any input from a given gamepad. This property is a hPressable, so it behaves like a button and can be pressed, justPressed, etc. It is considered pressed if any button or stick is pressed, and its position is equal to the most-pushed input of the gamepad.

  • Simplified vibrations
    Rumble is now much easier to use ! There's only one method called Vibrate, that takes a duration and intensity for both sides. You can omit any of these parameter to replace them with default values, or use no parameter at all !

fixes:

  • hinput now works in WebGL builds
    The source of our problems was XInput. If you're making a WebGL project you should either not import the folder from hinput, or delete it. hinput will still work the same, except you won't be able to use vibration.

  • hinput now works with old versions of unity
    I replaced all the code that was too recent.

v1.2.5: anyGamepad vibrates all controllers

31 Oct 21:35
Compare
Choose a tag to compare
  • hinput.anyGamepad.Vibrate now vibrates all controllers
    Someone suggested that anyGamepad could vibrate all controllers at once. It sounds pretty obvious to me now, so I'm counting it as a bug fix.

v1.2.4: Stop vibration when exiting play mode

31 Oct 20:43
Compare
Choose a tag to compare
  • Stop vibration when exiting play mode
    Until now, stopping the game while a gamepad was vibrating would cause the gamepad to keep vibrating indefinitely. That's rather inconvenient, so I changed it.