The script i made doesn't record what the person presses after pressing the ` key. Thats all I really know. but you guys can look at it to see if theres any other things i could do..
var inputkey1 = "w";
var inputswitch = false;
var inputkey1valid = true;
var inputkeychanged = false;
var inputkey1a = "w";
var inputkey1b = "a";
var inputmessage1 = "1111111113022";
var inputkey2 = "2";
var inputmessage2 = "222223022";
var inputkey1false = false;
private var gt: GUIText;
function Start ()
{
gt = GetComponent(GUIText);
if( gt == null ) Debug.Log("No GUIText component found");
}
function Update ()
{
//to allow changing of keys ((press before remapping is taking place))
if(Input.GetKeyDown("`"))
{
inputswitch = true;
inputkey1valid = false;
inputkey1false = true;
}
//if you pressed the key of the choice to change and you pressed ` before change the inputkey to the recorded key
//and reset inputswitching to false so it works and stays that variable.
if(Input.GetKeyDown(inputkey1) && inputswitch && inputkey1false)
{
var inputkey1b = Input.GetKeyDown;
inputswitch = false;
inputkeychanged = true;
inputkey1valid = true;
inputkey1false = false;
}
if(inputkey1false)
{
inputkey1valid = false;
}
//if the keys are opted to change then its the changed/recorded key
if(inputkeychanged)
{
inputkey1 == inputkey1b;
inputkey1valid = true;
}
//reset the keys if = is pressed.
if(Input.GetKeyDown("="))
{
inputswitch = false;
inputkeychanged = false;
inputkey1 == inputkey1a;
inputkey1valid = true;
}
if(Input.GetKeyDown(inputkey1) && inputkey1valid)
{
gt.text = inputmessage1;
}
if(Input.GetKeyDown(inputkey2))
{
gt.text = inputmessage2;
}
}
if it isn't absolutely necessery I wouldn't use an ingame console to change keys, I would use the input manager under project in the edit menu.
– Myth