- Home /
How to add custom input to InputManager?
I'm making a gesture based game with Omek and Unity, but I'm having trouble figuring out how to add different input methods to the InputManager. Any help?
EDIT I really should have been more specific with my issues, and I apologize for that. I'm attempting to use the CharacterController to move my player piece around, but this only takes input from the InputManager, which by default only uses joysticks or mouse/keyboard. I'm wondering if there's a way that I could add gestures (aka add some outside input source) to that, or if I'm better off not using the Controller like I've been doing.
"I want to make a racing game! Please help me." With that attitude and the little detail, why should I?
I'm sorry if I wasn't specific enough, I posted this at the end of a long day and was a bit frustrated by the issues, so I will revise and add more detail.
If you are looking to support multiple builds and devices, you should have a look at some examples on how different inputs are controlled.
From the Unity Wiki, check the Update method, where it checks if running in editor then use mouse inputs (else use touch) : http://wiki.unity3d.com/index.php/Tap_to_$$anonymous$$ove_Drag_to_Look_iPhone
This is Platform Dependent Compilation : http://docs.unity3d.com/Documentation/$$anonymous$$anual/PlatformDependentCompilation.html
A more thorough test case would be angry bots. Check the Player$$anonymous$$oveController script :
// ....
#if UNITY_IPHONE || UNITY_ANDROID
if (joystickPrefab) {
// ....
}
#elif !UNITY_FLASH
if (cursorPrefab) {
// ....
}
#endif
// ....
// HANDLE CHARACTER $$anonymous$$OVE$$anonymous$$ENT DIRECTION
#if UNITY_IPHONE || UNITY_ANDROID
motor.movementDirection = joystickLeft.position.x * screen$$anonymous$$ovementRight + joystickLeft.position.y * screen$$anonymous$$ovementForward;
#else
motor.movementDirection = Input.GetAxis ("Horizontal") * screen$$anonymous$$ovementRight + Input.GetAxis ("Vertical") * screen$$anonymous$$ovementForward;
#endif
Answer by Benproductions1 · Jul 17, 2013 at 01:40 AM
Unity's Input manager only takes input from supported devices. It also doesn't allow you to change anything at runtime.
If you want either of thes features, you will need to manually add them yourself
$$anonymous$$ake your own Impot$$anonymous$$anager, that handles the hardware input, probably though a dll. For instance, with XBox controllers, it's the XInput API that you need.
Answer by Mill0698 · Jul 16, 2013 at 03:59 AM
If you are talking about the number of parameters the input manager takes in, just change the 'Size' Number. Input Manager