Search Unity

Cause of screen position out of view frustum error?

Discussion in 'Web' started by Ewanuk, Jan 19, 2018.

  1. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    I have two builds of a project, Windows Standalone and WebGL.

    Standalone is fine, but this error shows up each frame on my WebGL builds:

    Screen position out of view frustum (screen pos 0.000000, 0.000000, 10000.000000) (Camera rect 0 0 0 0)

    What specifically causes this error? When the camera's generated viewport covers zero pixels? When the frustum volume/size is indeterminate? (There being a zero where there shouldn't be?)


    Edit, I should elaborate, I'm getting this error after upgrading my project from Unity 5.5.1f1 to 2017.3f3
     
    Last edited: Jan 19, 2018
  2. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    After some more digging. In this case, the screen size is being reported at 0x0, I'm not sure why that is...

    The canvas element that contains the game container is sized correctly...:

    upload_2018-1-19_11-52-40.png
     
    Last edited: Jan 19, 2018
  3. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    I made a mistake, it looks like I just needed to make a div to assign to the canvas. Not have a canvas inside a canvas.

    upload_2018-1-19_12-31-53.png
     
  4. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    I tweaked the loading logic, now I have this in the DOM:

    upload_2018-1-19_12-46-1.png


    I'm not getting screen size error anymore, and unity is now correctly reporting a non-zero screen size, but nothing is getting rendered except the background color defined in web.json.

    Any idea what's going on?
     
  5. JJJohan

    JJJohan

    Joined:
    Mar 18, 2016
    Posts:
    214
    I experienced the camera frustum error when I set my canvas element to display:none (to load it in the background). It seems that since 2017.3 this now throws the above error with the screen rect 0 0 0 0.

    Your gameContainer also has a background colour set, have you tried removing that?
     
  6. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
  7. FionNoir

    FionNoir

    Joined:
    Aug 25, 2015
    Posts:
    14
    Hi, I've got the same issue with the frustum error in WebGL, but I don't get your solution.
    My div with the canvas inside is set to "display: none" by jQuery. So how can I avoid that error anyway.
     
  8. FionNoir

    FionNoir

    Joined:
    Aug 25, 2015
    Posts:
    14
    Ok, I've got a dirty solution for this issue in my case.
    I've written a function in Unity to disable my main camera. So every time I'm hiding the container with the Unity WebGL (modal or dialogbox), I'm going to call the function do disable the main camera from JavaScript and the error disappears.