Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TypeError: prevViewport is null

Discussion in 'Web' started by patrickk2, Feb 24, 2021.

  1. patrickk2

    patrickk2

    Joined:
    Dec 8, 2019
    Posts:
    92
    Hello everyone!

    I had the following error popping up in a WebGL build of my project:

    I had no luck finding anything about that "prevViewport is null" problem, and was hoping that somebody could give me a hint or some advice for tracking this issue down.

    The project was built with Unity 2020.2.5f.

    Thanks in advance and best regards,
    Patrick
     
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
  3. arrudaj

    arrudaj

    Joined:
    Jan 15, 2020
    Posts:
    2
    @jukka_j I'm experiencing this same issue as well. Project that has been upgraded (not recently) over time from 2018.x to the latest 2019.x LTS version. We have not intentionally enabled any multithreading support.

    Code (csharp):
    1. exception thrown: TypeError: prevViewport is null,
    2. _emscripten_set_canvas_element_size_calling_thread@blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2:8:208867\n
    3. _emscripten_set_canvas_element_size@blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2:8:209421\n
    4. @blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2 line 8 > WebAssembly.instantiate:wasm-function[10676]:0x417e52\n
    5. @blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2 line 8 > WebAssembly.instantiate:wasm-function[10674]:0x417821\n
    6. @blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2 line 8 > WebAssembly.instantiate:wasm-function[63827]:0x11e2651\n
    7. UnityModule/Module.dynCall_v@blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2:8:511356\n
    8. browserIterationFunc@blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2:8:189136\n
    9. runIter@blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2:8:192209\n
    10. Browser_mainLoop_runner@blob:https://redacted.com/454549cb-8e04-4b30-8046-d5114cf34df2:8:190671
     
  4. anthony_b_

    anthony_b_

    Unity Technologies

    Joined:
    Oct 27, 2020
    Posts:
    24
    Hi folks. Currently Unity uses a slightly older part of the Emscripten library here, and it does run this code without multithreaded support.

    Which browser are you observing this issue, and are you using the Automatic API choice, or limiting to WebGL 1 or WebGL 2 in your project?

    And does this happen occasionally or all the time?
     
  5. NiklasMoller

    NiklasMoller

    Joined:
    Dec 12, 2018
    Posts:
    6
    Hi,

    I experience a similar issue:

    Error.PNG Chrome80Windows.PNG

    I believe it is related to this line: autoResizeViewport=prevViewport[0]

    I had this issue testing on both Chrome 80 and Chrome 89, Windows 10. My graphicsAPI is set to Automatic API (["WebGL 2.0","WebGL 1.0"]), building from Unity 2019.4.

    @anthony_b_ For me, this occurs occasionally. It happens when the user clicks a button that opens the application into fullscreen.

    If this can be resolved, it would enable me to have my game open in fullscreen when it starts.
     
    Last edited: Apr 13, 2021
  6. arrudaj

    arrudaj

    Joined:
    Jan 15, 2020
    Posts:
    2
    I had this issue testing on both Chrome 80 and Chrome 89, Windows 10. My graphicsAPI is set to Automatic API (["WebGL 2.0","WebGL 1.0"]), building from Unity 2019.4.

    @anthony_b_ For me, this occurs occasionally. It happens when the user clicks a button that opens the application into fullscreen.
    My setup and occurrence is the same. Currently building with 2019.4.22f1.
     
    NiklasMoller likes this.
  7. patrickk2

    patrickk2

    Joined:
    Dec 8, 2019
    Posts:
    92
    Hello everyone!

    First of all thanks for sharing your insights and thoughts on this issue! Then I appologize for not answering so long, there were some private turbulences that kept me from development and the forum.

    The error did not pop up for me, since my original post, but just in case it helps I will also add what information I can.

    I checked my settings and confirmed, that I am not using the experimental multithreading enabled, and my graphics API is also set to automatic. The error occured in Firefox, but unfortunatelly I can no longer tell wich version since I updated in the meantime. The OS is Windows 10.

    Thanks again for all answers and best regards,
    Patrick