How can I stop input while splash screen is displaying?

While the splash screen is displaying, input appears to be queueing up.

for example:

    if (Input.GetKeyUp(KeyCode.Escape))
    {
        Application.Quit(); // <-- I have a Debug breakpoint here
    }

If the user hits escape while the splash screen is displaying, the splash screen continues. However, after the splash screen is done, my breakpoint hits immediately.

I’ve tried this (before the above code):

    if(!SplashScreen.isFinished)
    {
        return;
    }

However, that doesn’t resolve the issue. After the splash screen is finished, the Input.GetKeyUp(KeyCode.Escape) returns true and my breakpoint still gets hit. I assumed perhaps that the input simply isn’t processed till then so what I needed was essentially to skip the first frame and let the GetKeyUp call get reset.

I added the following below the SplashScreen.isFinished call:

    if(!IsInitialized)
    {
        IsInitialized = true;
        return;
    }

So the first time the Update call is run, it simply returns. That frame is essentially skipped from checking input. However, that doesn’t work if the user has pressed multiple keys (or the same key multiple times) as it’s just processed on the following frame, and the one after that, and the one after that…

The only way I’ve successfully gotten this to actually work is to change my IsInitialized check to:

    if(!IsInitialized && !Input.GetKeyUp(KeyCode.Escape) && !Input.GetKeyUp(KeyCode.LeftArrow) && !Input.GetKeyUp(KeyCode.RightArrow) && ..) // <-- check every key my application uses
    {
        IsInitialized = true;
        return;
    }

    // Future calls are properly handled as the game is actually playing and the queued input is effectively flushed

However, this feels like a terrible, terrible hack. Is there any other logical way around this? Is this a bug in the splash screen? Is there a way to flush the input events after the splash screen is done?

This has been repro’d and logged as a bug by the Unity team.