I´m having a rough time trying to figure out a proper way of dealing with key mapping and key bindings in unity. The built-in unity input manager is useless to me since it doesnt support key mapping ingame and you cant acces it via script, you can only change your key bindings on the game laucher, but not ingame.
I guess I will need to create my custom InputManager to replace the unity one but im pretty much lost in this matter. So far I´m beein doing some research and now I know how to create a basic but robust input manager in C++ (thanks mainly to this tutorial http://www.gamedev.net/blog/355/entry-2250186-designing-a-robust-input-handling-system-for-games ) But as i said I dont know how to translate this into unity c#.. My first idea was to create a complete new input manager from scratch that use an xml file to store the key binding data, but I dont know if you think this is the wrong way to follow. First of all I dont even know how could I acces RawInput in unity. Checking the script documentation was of no use in this matter, i found something about keyboard events but they only work under OnGUI function and I dont know if i should use it then...
I know there are some commercial plugin out there for that solve this purpose but thats not the point, I´m trying to do it this by myselft
Could someone explain to me how could I make my own InputManager from scratch or give me some indication to put me in the right way to this?
I apologize for my bad english btw
-EDIT FOR CLARIFICATION:
Im trying to achieve just the typical key mapping menu but I must be able to access this menu ingame, i mean, via pause menu. ingame->pause menu-> options-> controls. for example, I have the jump action mapped to the space bar, In my controls menu I select remap this this action. A dialog propt and wait for me to press the new key to map to the jump action. I press ctrl (or whatever key)...and then I update the dictionary, jump action = ctrl (or whatever keycode it is). But the issue is, how do I know which key did I just pressed while the dialog waiting for a new key was active? Should I use something like:
void OnGUI() {
Event e = Event.current;
if (e.isKey && remapping)
remap(action, e.keycode);
or if not just a bunch of if statements, one for each keycode of the keyboard i mean
if Input.getKey('keycode') remap(action, keycode);
what surely will work but just use about 100 if statemens
I hope I explained myself clearly now. Anyway I was doing some research before start writting any code but I will do a script what I thought so far and then post it for a better understanding.