All Settings Pro Getting Keycode

General support.
Post Reply
User avatar
ThePrimePillow
Contributor
Contributor
Posts: 65
Joined: Thu Feb 22, 2018 10:10 pm

Hello, I wanted to get help with the asset All Settings Pro. I want to be able to get the button name of an input like so "Press [input] to spawn]" so if my input was A, I would get "Press [A] to spawn]." I tried to use the GetKeyCode function but the summary above it is blank so I don't know how to use it. In short I want a way to return the bound button of an input as a string.
User avatar
ThePrimePillow
Contributor
Contributor
Posts: 65
Joined: Thu Feb 22, 2018 10:10 pm

Bump
User avatar
Lovatto
Admin
Admin
Posts: 1772
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

You can add this getter in bl_Input.cs

Code: Select all

  public string GetInputNameOf(string function)
    {
        for (int i = 0; i < AllKeys.Count; i++)
        {
            if (AllKeys[i].Function == function)
            {
                return AllKeys[i].Key.ToString();
            }
        }
        return $"'{function}' input is not defined.";
    }
Then you can get a Input Manager input key name like this:

Code: Select all

string inputName = bl_Input.Instance.GetInputNameOf("Spawn");//replace the input function name
        string instructionStr = $"Press [{inputName}] to spawn]";
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
ThePrimePillow
Contributor
Contributor
Posts: 65
Joined: Thu Feb 22, 2018 10:10 pm

It works perfectly, thank you. :D
Post Reply