Redefining input within game

How can I change what input is associated with what action when playing a game in unity as opposed to using the unity interface to mapping input? Either as an ingame main menu - redefine keys option, or by pressing a specific key to alter key-mappings during the game.

Instead of using Unity3D's predefined input constants, create a Hashtable which holds associated action string (or number) as the key, and the actual keyboard code associated with the key.

You can create new or change existing mappings by modifying the hashtable.

(Warning :untested code!)

public static var key_lookups : Hashtable = new Hashtable;

function Start() {

key_lookups["down"] = KeyCode.S;

}

function Update() {

   if (Input.KeyDown(key_lookups["down"]))
        // go down...

}