Facepunch / sbox-issues

176 stars 12 forks source link

Inputs set in project settings do not take effect when playing in editor #5906

Open vinceTheProgrammer opened 3 months ago

vinceTheProgrammer commented 3 months ago

Describe the bug

Input buttons defined in the editor project settings do not take effect when playing the game in the editor environment.

To Reproduce

  1. Create brand new project
  2. Create GameObject
  3. Add script to GameObject
  4. Define a logger in the script
    private Logger Logger = new Logger( "InputThing: " );
  5. Add the following to an update method in the script:
    Logger.Info( "Forward button origin: " + Input.GetButtonOrigin( "Forward" ) );
    if (Input.Down("Forward"))
    {
    GameObject.Transform.Position += new Vector3( 0, (float) 0.1, 0 );
    }
  6. Go to Project > Settings > Input > Movement and change the forward input to a key other than "w", such as "k".
  7. Play the game and observe that even though the button origin is correctly shown to be the new key you set, only the "w" key actually works to move the GameObject.

Minimal reproduction: https://github.com/vinceTheProgrammer/input-bug-reproduction

Expected behavior

I expect that if I set a button for a particular input in the project's settings, it should reflect properly when testing the game in the editor.

Media/Files

Screenshot 2024-07-23 203918

Additional context

trundlr commented 3 months ago

Just a little FYI - you do not need to define your own logger unless you want to 😸

DevulTj commented 3 months ago

I have a feeling this is because you're trying to overwrite the common input actions that have local preferences

vinceTheProgrammer commented 3 months ago

I have a feeling this is because you're trying to overwrite the common input actions that have local preferences

Yeah, that's probably it because if I make an input action with a different name, for example "Run_c" instead of "Run", I can bind it to whatever just fine.

Is that the intended behavior though? It seems a little counterintuitive to ignore the bindings the dev sets without at least warning the dev that their bindings are being overwritten because the input action is part of the set of common input actions.

DevulTj commented 1 month ago

I don't believe this is happening anymore (?), can you verify