
http://adamscott.github.com/OInput
Quick start
// In Start()
OInput.GetDefaultProfile()
.SetButton("Jump", "space")
.SetButton("Fireball", "left ctrl");
// In Update() loop
if (OInput.GetDefaultProfile().GetButton("Jump")) {
Debug.Log("The plumber jumps.");
}
if (OInput.GetDefaultProfile().GetButton("Fireball")) {
Debug.Log("The plumber throws a fireball.");
}
Features
-
Runtime actions
Create own custom actions in code instead of trying to setup everything in the Input Manager. -
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. -
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. -
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. -
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
- InputManager.asset as been borrowed from the ouya-unity-plugin project for (the awesome) Ouya. Thanks to Tim Graupmann and the Ouya Dev Team. Visit the project’s website: GitHub - ouya/ouya-unity-plugin: OUYA Plugin for Unity
- OInput is released under Apache License 2.0.