I’m trying to record button presses in a document outside of Unity. The presses are being recorded, but I only want it to print once for every time the button is pressed. I thought using Input.GetKeyUp in Update() would accomplish that, but I’m still getting several outputs for one single button press. This is the code I have now. Can you see anything wrong with it or do you have any suggestions for how I can do this? Thanks!
private string directionChosen;
void Update () {
string path = @"/Users/saradiaz/museum/Log/responses";
//string path = @"C:\Users\ccn\Desktop\Sara rain\Log\coords";
if (Input.GetKeyUp("right")) {
directionChosen = "
right";
}
if (Input.GetKeyUp(“left”)) {
directionChosen = "
left";
}
if (Input.GetKeyUp(“up”)) {
directionChosen = "
straight";
}
System.IO.File.AppendAllText(path, System.String.Format(“{0}”, directionChosen));
}
}
P.s I’ve also tried KeyCode.UpArrow etc instead of the strings.