Friday, 24 October 2014

Custom Input Manager

I decided to make my own input manager as Unity's built in on does not support access at runtime which means you can't change sensitivities or even change button layouts. It's quite simple in comparrison to everything else. It works in a similiar fashion to the existing one but not like the existing one.

Appropriately named...

It works like this: You create inputs and give them each a name. In my screenshot, "LDirection" means the Left analogue stick direction or equivilent (WASD on keyboard). I should really change the name to something like "Movement Input Direction" as this is more understandable and relevant. Each of these inputs then have connected inputs, at the moment, I have only made it so you can hook into Unity's input manager itself, but eventually I shall make it so you can hook in raw inputs. You can connect as many inputs as you want and it will pick the one with the highest value. You can choose whether a particular input (my inputs, not the connected inputs) is a direction, in which case it will return a vector2 (x,y) and not just a float. If you choose it to be a direction, then you have to have multiples of two amount of connected inputs, one for x and one for y. You can also specify if it is a mouse input, in which case it returns a value that is not framerate dependent, but time dependent (unlike how Unity's input manager defaults to). In my input manager you can change everything that I just spoke about at runtime, making it far more open whilst keeping it in one place!

xoxoxo

0 comments:

Post a Comment