I Have Recently Started Working On Custom Input, And Am Stumped At The Beginning - How To Let The Player Change Input In Game. I Have Thought About How It Could Be Done, And This Is My Idea. To Convert The Currently Held Button To A String. Im Not Sure How This Could Be Achieved, Which Is Why Im Here. So If Anybody Knows, Or Has Any Thoughts I Would Be Glad To Help. Thanks!
-Seth
1 Answer
1
Two ways I can think of are to use GUI events and use Input.inputString. Input.inputString contains any characters typed during the last frame.
#pragma strict
function Update () {
if (Input.inputString.Length > 0) {
Debug.Log("Update: "+Input.inputString[0]);
}
}
function OnGUI() {
var e = Event.current;
if (e.type == EventType.KeyDown && e.character != 0) {
Debug.Log("GUI: "+e.character);
}
}
Thanks, Will Work On The Controls Now, And One More Question, Does It Also Work For Gamepads?
– Seth-McCumber