How to bind key with string path. Bind key with listening in playmode

Hello.
I have string variable with path of a button. I need to bind in code, how can i do that?

There may be a way to assign a button through listening in a gamemode like in an editor.
A custom controller is used. During the assignment, many buttons are pressed and I need to select only one in the drop-down menu. Any ideas?

5864725--623827--Screenshot_13.png

I was figuring this out and found a solution:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Binding : MonoBehaviour
{
    int index = -1;
    KeyCode[] bind = new KeyCode[10];
    private void Start()
    {
        for (int i = 0; i < bind.Length; i++)
        {
            bind[i] = KeyCode.A;
        }
    }
    private void OnGUI()
    {
        if(GUI.Button(new Rect(200, 200, 300, 40), ((bindName)0).ToString() + " : " + bind[0].ToString()))
        {
            index = 0;
        }
        Event e = Event.current;
        if (index != -1)
        {
            if (e.isKey)
            {
                bind[index] = e.keyCode;
                index = -1;
            }
        }
    }
    private void Update()
    {
        if (Input.GetKey(bind[0]))
        {
            Debug.Log("works");
        }
    }
}
public enum bindName
{
    move_forward
}

it’s easy and effective all you need is to call bind one maybe you need to do few twicks for your self