Search Unity

Multiple WebGL elements without repeating splash screen

Discussion in 'Web' started by uwdlg, Feb 9, 2021.

  1. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    150
    Hi,

    for an interactive website experiment I'm working on with a web developer, we would like to mix "normal" html/JS content with small interactive WebGL parts made with Unity. I don't mean displaying different WebGL instances side-by-side at the same time, but having different WebGL scenes show up when navigating through the site interspersed with non-WebGL content (meaning any two WebGL scenes are strictly apart both in space and time). Since WebGL and non-WebGL content would take turns, we can't simply show the WebGL canvas and have it go through one scene after the other. My current understanding is that using a separate instance for every new WebGL scene would mean having the Unity splash screen (unavoidable with the free plan) plus a loading screen show up every time. The latter will probably be hard to avoid completely but could be made to look inconspicuous, but is there some clever way of avoiding the former (except for once of course)? The WebGL parts should blend in as best as possible (we have for example experimented with a transparent background to have 3D objects "float" on top of the "normal" website) and the splash screen showing up in the middle of things would be quite distracting I believe.
    Ideally I would like to get the splash screen out of the way once in the beginning - before "immersing" the user in the website - and then smoothly transition back and forth between plain HTML and WebGL afterwards.
    I would like to know if there is a way to only show the obligatory splash screen once (without upgrading from the free plan) - would we need to somehow reuse the same iframe, hide and show it as needed and tell the WebGL instance to load the scene we currently need or is there a more "tidy" way?
    I hope somebody encountered a similar situation before and can offer some insight (and my use of air quotes is not "repulsive" :D), thanks!
     
  2. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    I don't know a way to bypass the loading screen.

    My intuition is that it might become a bigger compatibility-headache across all browsers using a hidden iframe, or other floating JS tricks to accomplish this… and no guarantee how long it would stay compatible as browsers update.

    I'll go with a 'frame challenge' to the question and ask if it's possible to replicate the non-GL sections in Unity UI? links can OpenURL..., text can be read from xml…
    A self-contained project is going to be easier to manage and is (somewhat) more future proof.
     
  3. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Unfortunately there is no way to collapse the splashes to show only once per page load: if that was the case, then it would enable a way to completely disable the loader splash as well.

    Not a big fan of that whole feature in general, though legalese and marketing are what they are..

    One thing you can do is to lay out an image element or other HTML DOM element on top of the Unity canvas while Unity is still loading. Or you can also lay out your non-WebGL rendered canvas on top of the Unity canvas as long as Unity is loading. That way you can maybe have a more seamless transition.

    It is not perhaps in the pure spirit and intent of the free Unity build mode, but I doubt nobody will ever care.
     
  4. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    150
    Thank you for the answers!
    @wetcircuit I hope some trickery will turn out to work for us, because while (maybe?) theoretically possible, doing everything in Unity would essentially put my web dev buddy out of work while overburdening me, not to mention the usability compromises like not being able to e.g. select and copy text the familiar way out-of-the-box. I believe the web techniques paired with my buddy's experience enable responsive UIs more easily.

    That's what I feared. Still, your suggestions sound like the most fitting way of doing things for now - until this little project develops into something more and going Pro makes sense.
    Thank you!