Search Unity

Bug New input system stops working in WebGL on iOS/iPadOS devices in chrome/safari after switching tabs

Discussion in 'Input System' started by DrViJ, Dec 20, 2021.

  1. DrViJ

    DrViJ

    Joined:
    Feb 9, 2013
    Posts:
    158
    1. What happened:
    New input system stops working in WebGL on iOS/iPadOS devices in Google Chrome after switching between browser tabs.

    2. Reproduction:
    2.1 Take a project with new input system (Unity Touch Samples for example, I attached it with bug report)
    2.2 Build it for WebGL and upload to your server
    2.3 Open it with iOS device and make sure input works just fine.
    2.4 Switch tab in browser or create new tab and then return to tab with Unity Player. Input stops working

    Video of my reproduction:


    Bug reported, case 1389839
     
    Last edited: Dec 20, 2021
    coldpizzapunk likes this.
  2. coldpizzapunk

    coldpizzapunk

    Joined:
    Aug 20, 2014
    Posts:
    30
    I have noticed a similar issue when opening up an iFrame element and then closing the iframe element as well. I don't know if this will help in your case, but in the index.html I added the following:

    Code (JavaScript):
    1.     canvas.addEventListener("mousedown", onMouseDown, false);
    2.      
    3.     function onMouseDown(event){
    4.         window.focus();
    5.         }  
    I found this solution from an old forum post: https://forum.unity.com/threads/returning-focus-to-webgl.338394/#post-2216923
     
    DrViJ likes this.
  3. DrViJ

    DrViJ

    Joined:
    Feb 9, 2013
    Posts:
    158
    Thank you, I will check it