Input.GetMouseButton breaks when focus is switched

Super simple script:

public class MouseTest : MonoBehaviour
{
    private bool lastHeld;

    public void Update()
    {
        var isHeld = Input.GetMouseButton(0);
        if (isHeld != lastHeld)
        {
            Debug.Log($"Frame: {Time.frameCount}, Held: {isHeld}");
            lastHeld = isHeld;
        }
    }
}

Steps to recreate:

  1. Run game
  2. Click (value changes to true :white_check_mark:)
  3. Release → (value changes to false :white_check_mark:)
  4. Click clear in editor log below (losing focus on game)
  5. Click back in game (value changes to true, then false next frame! :x:)

Hi,
I’m having the correct behaviour and can’t reproduce.
I’m running 2019.4.13f1, what’s your Unity version?

I’m running 2020.2.1f1 on Windows 10 Home.

Just an addendum:

Clicking outside the unity editor window does not cause the bug. (e.g. on the windows desktop)
Clicking on other Unity editor components does (e.g. on an inspector window)