Search Unity

OInput — One (open-source) script to ease input setup in Unity projects.

Discussion in 'Assets and Asset Store' started by adamscott, May 30, 2013.

  1. adamscott

    adamscott

    Joined:
    May 30, 2013
    Posts:
    2


    Quick start
    Code (csharp):
    1.  
    2. // In Start()
    3. OInput.GetDefaultProfile()
    4.     .SetButton("Jump", "space")
    5.     .SetButton("Fireball", "left ctrl");
    6.  
    7. // In Update() loop
    8. if (OInput.GetDefaultProfile().GetButton("Jump")) {
    9.     Debug.Log("The plumber jumps.");
    10. }
    11.  
    12. if (OInput.GetDefaultProfile().GetButton("Fireball")) {
    13.     Debug.Log("The plumber throws a fireball.");
    14. }
    15.  

    Features
    1. Runtime actions
    Create own custom actions in code instead of trying to setup everything in the Input Manager.​

    2. Accepts both string parameters and built-in ones
    Like the built-in Input class, you can write down keys or axes in string format or by using OInput public enums.​

    3. Profiles: multiple profiles and profile persistence
    With profiles, actions are now independent of controllers. Profiles can be used to set multiple ways to control the game too.​

    4. Controllers: controller support and controller wrappers
    OInput supports joystick right out of the box. Controller wrappers (for Xbox 360 controllers and Ouya) give the opportunity to set controls once, no matter the platform running the game.​

    5. Buttons and axes: button and axis detection and multiple ways to set axes
    Axis and button detection can be helpful for custom, in-game, keyboard and controller configuration. OInput packs a bunch of methods to help set axes (virtual axes by keys, axis remap or mixing two axis together).​


    How to install
    Be sure to backup your project first or try OInput in a new project. OInput is in alpha state for now.
    • Download or clone the project.
    • Put the OInput folder in the Assets/Standard Assets/Scripts folder of your project. If the folder doesn't exists, create it.
    • Replace the InputManager.asset file in the ProjectSettings folder by the one you downloaded.

    Notes
     
    Last edited: May 30, 2013
  2. spartan

    spartan

    Joined:
    Mar 10, 2010
    Posts:
    174
    Hey Adam, nice work. Are you going to add GameStick support?
     
  3. adamscott

    adamscott

    Joined:
    May 30, 2013
    Posts:
    2
    Thank you Spartan.

    For GameStick support, yes, why not? Thanks for the tip, I just signed up for the SDK.
    When I will know which buttons and axes the GameStick controller maps to, I will create a new wrapper. In fact, wrappers are quite easy to make with OInput.