I have been working on a script that when I look at a game object tagged “Drawer” a GUI text object displays “Press ‘e’ to open drawer” but if the input manager has the “Open” axis key changed to any other key the GUI would be misleading. How can I set up the positive button for “Open” as a string variable? This is what I have now:
if(lookingAtHit.transform.gameObject.tag == "Drawer 2"){
centerText.guiText.text = "Press 'e' to open drawer.";
centerText.guiText.enabled = true;
bool x = Input.GetButton("Open");
if(lookingAtHit.transform.gameObject.tag == "Drawer 2"){
centerText.guiText.text = "Press '" + openButton + "' to open drawer.";
centerText.guiText.enabled = true;
bool x = Input.GetButton("Open");
The first code snippet is what I have. The second one is what I want to do but I don’t know how to make the variable openButton.