change input key from a script

how do i do this? any help is appreciated.

If you’re looking to change an input key at runtime, store the desired key in a static variable and reference it in your code:

//GameSettings.cs
public class GameSettings
{
   public static GameSettings Settings;

   public KeyCode ToggleEngineKey = KeyCode.H;
}


//PlayerInput.cs
public class PlayerInput
{
   void Update()
   {
      if (PlayerControlled)
      {
         if (!SpawnMenu.IsPaused)
         {
            if (Input.GetKeyDown(GameSettings.Settings.ToggleEngineKey))
            { EnableEngines(!EngineRunning); }
         }
      }
   }
}

Also, be more descriptive next time and show any relevant code you’re working on.