Skip to content

[0.2.8-preview] Build queues input while not in focus. #594

@SKroell

Description

@SKroell

We got multiple game events that is triggered by the user pressing a specific key. Currently we got RunInBackground disabled in the Player settings hoping that the game won't react to input while not in focus, but this doesn't seem to be the case.

Using the simple code below, we got a TestAction thats setup to trigger when pressing the 'A' key on the keyboard (press-only). If you alt-tab out of the game and press A multiple times, the log will quickly populate with "TestAction Performed!".

private void Start()
{
    TestControls input = new TestControls();
    input.TestActionMap.TestAction.performed += TestActionOnPerformed;     
    input.Enable();
}

private void TestActionOnPerformed(InputAction.CallbackContext obj)
{
    Debug.LogError("TestAction Performed!");
}

In 0.2.1 there was an toggle in the input settings "RunInBackground", but I can't recall if that was working. Has the setting been moved to somewhere else? Disabling and Enabling action maps in OnApplicationFocus gives the same result aswell.

Repo:

  • Extract InputInBackground.zip & open it with Unity 2019.1.0f2
  • Build with development build enabled
  • Open the executable and alt-tab to loose focus
  • Press 'A' one or multiple times
  • Re focus the window and look in error log (should have "TestAction Performed!" printed for everytime you pressed 'A'

InputInBackground.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues where existsing functionality misbehaves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions