string GetText(string description, [int input], [bool returnBlank])
string GetText(int index, [int input], [bool returnBlank])


description: The name/description of the action you want to get the text for.
index: The index number of the action you want to get the text for.
input: Which input you want to get the text for.
returnBlank: Whether or not "None" should return an empty string. Defaults to false.


Returns the text of the input used for the action. This is useful for making custom UIs.

Possible valid values for input are 0, 1, and 2.

  • Passing in 0 will return the description of the action.
  • Passing in 1 will return the name of the primary input assigned to the action.
  • Passing in 2 will return the name of the secondary input assigned to the action.

Note that input is optional, and if omitted will default to 0 if you use the index as the first parameter of GetText(). It will default to 1 if you use the description as the first parameter of GetText().

If no input is assigned to the action (as may often be the case with secondary inputs), then GetText() will return "None" by default, or it will return an empty string if returnBlank is true.

See the Making a Custom GUI Menu section for more details on how and why you might want to use GetText().


cInput.SetKey("Shoot", Keys.LeftControl, Keys.RightControl); // index for this key is 0 in this example Debug.Log(cInput.GetText("Shoot")); // displays "LeftControl" Debug.Log(cInput.GetText("Shoot", 1); // also displays "LeftControl" Debug.Log(cInput.GetText("Shoot", 2); // displays "RightControl" Debug.Log(cInput.GetText("Shoot", 0)); // displays "Shoot" Debug.Log(cInput.GetText(0)); // displays "Shoot" Debug.Log(cInput.GetText(0, 0)); // also displays "Shoot" Debug.Log(cInput.GetText(0, 1); // displays "LeftControl" Debug.Log(cInput.GetText(0, 2); // displays "RightControl" cInput.SetKey("Jump", Keys.Space); // Note that no secondary input is assigned to this key Debug.Log(cInput.GetText("Jump", 1); // displays "Space" Debug.Log(cInput.GetText("Jump", 2); // displays "None" Debug.Log(cInput.GetText("Jump", 2, true); // displays "" (an empty string)

results matching ""

    No results matching ""