Search Unity

Bug UI button stops working permanently after switching tabs on mobile Safari.

Discussion in 'Web' started by Marks4, Dec 29, 2020.

  1. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    1 - Create a UI button. When it's clicked, set SetActive to false. Or whatever. Any visible effect.
    2 - Select WebGL as the target and build the project.
    3 - Host the build folder somewhere, I usually use https://app.netlify.com/ .
    4 - Now access the game with Safari, on an iPhone. You click on the button and it goes invisible. That's it, great. The problem comes on the next steps.
    5 - Reload the page.
    6 - If you already have multiple tabs open, switch to any other tab on Safari. If not, create a new tab and switch to it.
    7 - Switch back to the game tab.
    8 - Try to click on the button. It won't work.

    Unity version: 2020.2.1f1.

    This bug doesn't seem like a big deal, but it is. Specially when you have a game with buttons that opens links to new tabs, redirecting to social media websites for example. Then the client wants to go back, and the buttons are not working anymore.
     
    iJedJ likes this.
  2. iJedJ

    iJedJ

    Joined:
    Jun 1, 2016
    Posts:
    1
    I have this bug on a project with Unity 2020.1.1f1, in fact this bug only occurs once with Safari (if I reload the page the bug no longer appears and I can open as many links as I want ) but it is permanent with Chrome (Firefox is not affected).
    @Marks4 : Did you find a workaround ?
     
  3. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    The bug is permanent on Safari for me. I didn't test on other browsers on the iPhone. But it doesn't happen on Chrome for Android. Unfortunately I didn't find any workaround.
     
  4. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @jukka_j I see that you're back! I am so glad! I created a bug report about this issue but so far it doesn't seem that it was acknowledged, I didn't get any reply from the devs.
     
  5. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Hmm, would you be able to do a video to showcase the issue? Looks like the STR has a few steps. (Also was there a bug number recorded?)
     
  6. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    There is no bug number because Unity never got back to me with the fogbuz entry. I am preparing an example to upload here.
     
  7. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @jukka_j Here's a video showing the problem. When I click on the button, a text shows up. After I reload the experience, open a new tab and go back to the webgl experience, I can't click on the button. The control does not go back to Unity. The button is unclickable.
     

    Attached Files:

  8. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @jukka_j Should I try to send another bug report, or is this being tracked? I'm sure this bug doesn't seem like a big deal, but it is. There are experiences where I need to put social media buttons like facebook and instagram and the client wants them to open on a new tab, and when the user switches back to the experience he can't click on anything.
     
  9. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks for the video, now it is more clear. Looking at our bug database, I don't unfortunately see an issue that would have reached the WebGL team at least. If it has been a long ago since you reported the first issue, maybe try opening another one. Preferably attach the video so that QA can concretely see the issue in action.
     
  10. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @jukka_j A fogbugz entry was just created with the same title as this thread. Did you get it?
     
  11. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    When an issue is reported to Fogbugz, it actually goes first to QA inbox for triage, so we don't see the issue in the web team until QA successfully reproduces it and flags it as an active bug to the team. Can you remind me some time next week if you don't hear back, and I can try to dig it up from the triage. Currently wrangling some 15 bugs on my desk, so I'll give this one some time before breating over QA's neck.
     
    Marks4 likes this.
  12. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @jukka_j Hey man, I got a reply from "Joris Namajunas" from the customer QA team, that WebGL builds are not supported on mobile devices, so they won't create an issue for this. I guess you'll need to jump in.
     
  13. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Sorry about that. We have had conversation about the changed status of WebGL mobile development with QA, but it looks like our communication has not reached all corners of their team. I'll check out the issue.
     
    Marks4 likes this.
  14. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks, found the issue and reopened it.
     
    Marks4 likes this.
  15. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    Oh, that's the old one. A new fogbuz entry was created for the same bug. They are duplicated now. I hadn't noticed that the email was about the first bug report. The new one has the video attached. I guess it doesn't matter though.
     
  16. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @jukka_j ^
     
  17. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks, the bug reached it to the team, we'll schedule it for investigation.
     
    Marks4 likes this.
  18. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    I just tested this bug and unfortunately wasn't able to reproduce the problem with your example. I tried with a build from 2020.1 and 2021. When I switch tabs and return, the button still works for me. What version of Unity and iOS are you seeing this on?
     
  19. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @brendanduncan_u3d Hm that's unexpected. iOS version is 14.2. Unity version is 2020.2.1f1.
     
  20. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    That is strange. Only difference is I tested iOS 14.4. Maybe Apple actually fixed something for Safari? I'll ask a QA person to test it as well.
     
  21. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
  22. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Looking back at our bug database on this, the issue was fixed and landed to 2021.2.0a17 release branch on 04/26/2021, with the comment

    Fix for handling HDPI scaling; code cleanup.

    Unfortunately it looks like this fix has not yet completed backports to earlier releases. Bumped the priority of landing the backports.
     
    Marks4 likes this.
  23. tengkufathullah

    tengkufathullah

    Joined:
    Apr 3, 2017
    Posts:
    14
    I have similiar issue, is this fixed?
     
  24. engrihsanali87

    engrihsanali87

    Joined:
    Feb 10, 2019
    Posts:
    1
    In my Case! I am building game for Webgl and Ui Buttons works on all other browsers except on Safari using iPad.
     
  25. AytoMaximo

    AytoMaximo

    Joined:
    Aug 26, 2015
    Posts:
    76
    +1!

    My case:
    1. Click button int the WebGL app to open some url in a new tab.
    2.1 Return from the new tab back to webgl (left arrow) - everything is OK
    2.2 Go to all tabs, close the new one and switch to the WebGL tab - can't click anything there.
     
  26. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    191
    Same issue when closing the ios keyboard (just closing, not using the return key)
     
  27. SolidJakob

    SolidJakob

    Joined:
    Sep 6, 2021
    Posts:
    6
    Still having this issue with Unity version 2021.2.6f1
     
  28. yitz_unity

    yitz_unity

    Joined:
    Jun 22, 2021
    Posts:
    12
    I am having the same issue in Chrome on Android. Unity 2020.3.12f1
     
  29. Hachi-Lab

    Hachi-Lab

    Joined:
    Jul 9, 2017
    Posts:
    1
    I found a solution.

    My porject:
    • Unity 2020.3.25f1
    • Target Platform: WebGL
    • Test Device: iPhone(iOS14.8, iOS15.0.1), iPad mini(iOS 14.8)
    Issue:
    1. When I opened a new tab, OnApplicationFocus(false) was called at EventSystem.
    2. But return from new tab, OnApplicationFocus(true) was not called.
    So, I replaced EventSystem like this.
    It's working fine for me.
    Code (CSharp):
    1. using UnityEngine.EventSystems;
    2.  
    3. public class CustomEventSystem : EventSystem
    4. {
    5.     protected override void OnApplicationFocus(bool hasFocus)
    6.     {
    7.         // Do Nothing
    8.     }
    9. }
     
  30. gwon

    gwon

    Joined:
    Jul 8, 2012
    Posts:
    1
    It's work
    thank you
     
  31. kimvasquez17

    kimvasquez17

    Joined:
    Dec 19, 2017
    Posts:
    22

    Hi @gwon May I know your setup how you did this? Did you just replace the event system script? Because I can't make it work.
     
    michaelmcmurdy_amtote likes this.
  32. risyalfebrianto97

    risyalfebrianto97

    Joined:
    Aug 2, 2022
    Posts:
    8
    Thankyou!