Search Unity

Question Cannot use Camera component in WebGL

Discussion in 'Web' started by sethcook1, Feb 21, 2023.

  1. sethcook1


    Jan 10, 2020
    Hi, I've run in to a particularly weird issue that only happens when I switch the Unity build to WebGL.
    My camera component was not being applied to the game view; whenever I hit run, it just pretends there's no camera, and just shows an angle from underneath the floor (I think it's 0,0,0). Problem is, when I searched how to assign the camera to the game view, it shows a tab not only in the game view window, but also something I can select on the camera component itself.

    Here's the game tab in PC build, with the "Display 2" tab I need:
    here's the same tab, but switched platform to WebGL. The drop down button disappears!

    A similar thing happens to the camera component itself:
    PC build:
    WebGL build (Target Display is gone):

    I'm assuming there's something simple that I'm doing wrong out of ignorance. I couldn't find anything in the Unity manual saying cameras are handled differently.
    MarcoLong and amazeinggamedesign like this.
  2. MarcoLong


    May 5, 2023
    Today I encountered the same problem.
    Furthermore, if I use the WebGL platform, my application doesn't work and therefore I can't send it to Unity Play.
    However, if I use the PC platform, the application works and the Tab Display appears in the Game View, and also the Target Display property in the camera Inspector.
  3. De-Panther


    Dec 27, 2009
    WebGL has only 1 display target, the HTML canvas element.
    Try to switch the target display to Display 1 and then build.

    And report bug. If Unity disable/locks the option to switch target display in WebGL and show the camera in editor as if it draws to display 1, it should draw to the one target on runtime as well