Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug WebGl no UI Toolkit visible (BETA 6)

Discussion in '2021.2 Beta' started by mrSaig, Aug 12, 2021.

  1. mrSaig

    mrSaig

    Joined:
    Jan 14, 2010
    Posts:
    68
    Hi,

    i just tried the current Beta 6 with a new Project and a real simple UI ... works fine when running in Editor or Compiling to Windows Standalone ... but when compiling for WebGl the UI is not visible ... just the default skybox ...

    do i miss something here? or did i encounter a bug?
    Because when i look in this forum i see varius bug reports for webgl but all of them see the ui apparently and have other bugs..

    Thanks!
     
  2. Bastienre4

    Bastienre4

    Joined:
    Jul 8, 2014
    Posts:
    191
    Stupid question, but are you sure you built the correct scene? :p
     
  3. mrSaig

    mrSaig

    Joined:
    Jan 14, 2010
    Posts:
    68
    Haha yes I do :)
    same scene settings for Windows and Webgl build ... win shows ui buttons and the webgl does not
     
    Bastienre4 likes this.
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Hi @mrSaig,

    Could you please submit a bug report with a reproduction project attached to it for this issue?
     
  5. mrSaig

    mrSaig

    Joined:
    Jan 14, 2010
    Posts:
    68
    Yes just verified ... have the same issue with b7 ... just submitted the bug with a project and steps to reproduce
     
    LeonhardP likes this.
  6. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    In my experience with missing or pink materials in WebGL, it's often been a shader not being included in the build. This might not be the issue here, but worth noting in case that's all it is / for anyone else it might help.

    The easiest way to see if it's related to the build missing a shader (and quickly resolve the problem, if so) is by creating a Shader Variant Collection. To do this, open Project Settings->Graphics tab, scroll to the bottom. It will say for example "100 shaders tracked, 250 variants." Click "Clear" beside that, it will immediately reset to just the currently-in-use ones. Enter Play Mode, you'll see it increase as additional ones are used by your game.

    Once the content in question has been visible, while still in Play Mode, click "Save to asset...", save it somewhere, then exit play mode. Select (or drop) that asset to the "Preloaded Shaders" list. Build your project for WebGL and take a look in the browser - if the problem was a missing shader, it should now be visible.

    If you want to avoid preloading your collection until a time of your choosing (such as after something initial displays), there is a checkbox "Preload shaders after showing first scene", and if you need more precise control over timing, you can create a reference to the asset in a script and call WarmUp at runtime whenever. See here for more information and additional links.

    Also, if you only want to warm up a handful of specific shaders, you don't have to use the full collection as-is. You can select the Shader Variant Collection in the Project window then add/remove whatever through the Inspector.

    Something else you could try before the above (if you haven't), is to double check the javascript console for any errors. It might just be that your game never reaches the point where the UI would display due to an overlooked exception. See here for more info on tracking down issues in WebGL builds.
     
    msibrava, mrSaig, FlightOfOne and 3 others like this.
  7. mrSaig

    mrSaig

    Joined:
    Jan 14, 2010
    Posts:
    68
    LeonhardP likes this.