Search Unity

switching to full-screen causes webgl ugui freeze in unity2020

Discussion in 'Web' started by jerry_lh, Dec 16, 2020.

  1. jerry_lh

    jerry_lh

    Joined:
    Jun 18, 2017
    Posts:
    7
    When the browser of Android platform is used to view the webgl and full screen, the ugui interface after unity2020 does not respond.

    It's normal to go back to unity2019.4.17, and then I use unity2019.4.17 com.unity.ugui/Runtime/EventSystem Replacing unity2020, ugui can also work normally.

    The JS code for the full screen is as follows:
    function JSFullScreenEnabled(value) {
    if (value) {
    canvas.ontouchend = function () {
    SetFullScreen();
    }
    } else {
    canvas.ontouchend = null;
    }
    }

    function SetFullScreen() {
    if ( document.fullscreenElement Wei document.webkitFullscreenElement Wei document.mozFullScreenElement Wei document.msFullscreenElement )
    return;

    var element = document.documentElement ;
    if ( element.requestFullscreen {
    element.requestFullscreen ();
    } else if ( element.mozRequestFullScreen {
    element.mozRequestFullScreen ();
    } else if ( element.webkitRequestFullscreen {
    element.webkitRequestFullscreen ();
    } else if ( element.msRequestFullscreen {
    element.msRequestFullscreen ();
    }
    }

    There should be a bug in unity2020 ugui!
     
  2. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
  3. jerry_lh

    jerry_lh

    Joined:
    Jun 18, 2017
    Posts:
    7
    After repeated tests, only some Android models have this problem, such as MIUI 11.0.25
     
  4. jerry_lh

    jerry_lh

    Joined:
    Jun 18, 2017
    Posts:
    7
    @Joined:
    Thank you very much for your plug-in, but there are also problems after testing:

    FullscreenWebGL.jslib In the document: elem.addEventListener ('pointerup ') can't be full screen on this model, so I replaced pointerup with touchend to get the correct full screen, but the interface will freeze after full screen.
     
  5. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    Hm, that's weird mate. Pointer events are supported on mobile browsers as well. At least, it works here. See https://caniuse.com/?search=pointerup . And if your interface is freezing even with my plugin, it's definitely something with the device. It works fine here.

    EDIT
    Wait...something's wrong. The page says Safari doesn't support pointerup, but it works here. It also says it's not supported by firefox on Android...did you use firefox or chrome?

    EDIT
    Definitely supported on iOS Safari, as it says here https://webkit.org/status/#?search=pointer events , and you can test here https://codepen.io/appsforartists/pen/NRdLrv . However it's something fairly recent.

    You said you were using Android, I guess you were using firefox then.
     
    Last edited: Dec 17, 2020
  6. jerry_lh

    jerry_lh

    Joined:
    Jun 18, 2017
    Posts:
    7
    When the full screen interface of some Android browsers freezes, I replace the ugui event system of unity2020 with unity2019.4.17 com.unity.ugui/Runtime/EventSystem This problem can be solved. So I guess it's a bug in ugui eventsystem