Search Unity

Webgl context lost, how to restore lost context

Discussion in 'Web' started by Grzegorz_Chomik, Jun 28, 2017.

  1. Grzegorz_Chomik

    Grzegorz_Chomik

    Joined:
    Jun 28, 2017
    Posts:
    1
    I'm working on an application that has to work all the time in my browser. Unfortunately after some time the application lost contex. How to restore a lost context ???
    I ask you for help.
     
  2. splashdesign

    splashdesign

    Joined:
    Jul 14, 2017
    Posts:
    5
    Please help me,
    How can I restore a lost context????
     
  3. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    What do you mean by "lost context"?
     
  4. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    I suspect he means his gpu (driver) went idle and lost the direct3d/opengl context. We have same error occur once in a blue moon when Windows Update just happens to update a gpu driver while we're in the middle of running some WebGL content. It's not specific to WebGL obviously, any 3D application is susceptible.

    In general (hand waving), once a context is lost it's extremely difficult to restore (essentially in practice it's impossible).
     
  5. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    yes, if it's the direct3d/opengl context we are talking about, I don't think there is much Unity can do about it.
     
  6. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I see there is a webgl extension to simulate context lost. I'll look into it...
     
  7. Baraphor

    Baraphor

    Joined:
    Nov 16, 2016
    Posts:
    32
    Any Update to this issue?
     
  8. astyles_imb

    astyles_imb

    Joined:
    Nov 12, 2019
    Posts:
    5
    Any update on this?
     
  9. SupremacyLasse

    SupremacyLasse

    Joined:
    Sep 3, 2020
    Posts:
    3
    Any update on this? I'm getting context lost in mid-game with 2021.3
     
  10. EnigmaFactory

    EnigmaFactory

    Joined:
    Dec 10, 2011
    Posts:
    98
    Bumped. 2021.3 WebGL. Works on most PCs and most browsers excerpt some specific Windows 10 / 11 boxes with certain version of Chrome getting context lost. http://enigmafactorgames.com/parc
     
  11. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    271
    Hi folks. Would anyone here be willing to open a bug report for us to look into this "WebGL context lost" issue? We aren't aware of it outside of this thread and it hasn't shown up in our tests / other bug reports.

    Unfortunately there is no way to "restore" a lost WebGL context (see: https://www.khronos.org/webgl/wiki/HandlingContextLost)
    it can be re-created, but all the GPU data held by the previous context is gone.
     
    Last edited: Aug 24, 2023