Search Unity

Does DOTS work for WebGL builds?

Discussion in 'Entity Component System' started by Arowx, Apr 27, 2019.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Just tried building the Samples to WebGL and the scenes load but they are blank is there a way to get DOTS to build and work to WebGL?
     
    deus0 and Nyanpas like this.
  2. squarelover

    squarelover

    Joined:
    Nov 14, 2012
    Posts:
    31
    probably not lol
     
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    Why did you bump a 5 month old post
     
  4. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    The ForEach and ForEachWithEntityChanges, IJobForEach, IJobForChunk Samples Work!

    Subscene shows an empty scene.

    SpawnFromMono appears to work but has a cube out of position(bug)???

    The SpawnFromEntity and SpawnAndRemove does not, they crash with out of bounds errors.

    -- Update if you add this file to your project in the Editor folder https://gist.github.com/mtrive/01374844278d2ec377c7f6bbc4df4e6a#file-enablethreads-cs

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. [InitializeOnLoad]
    5. class EnableThreads
    6. {
    7.    static EnableThreads()
    8.    {
    9.        PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Wasm;
    10.        PlayerSettings.WebGL.threadsSupport = true;
    11.        PlayerSettings.WebGL.memorySize = 512;
    12.    }
    13. }
    • SpawnFromEntity - works!
    • SpawnFromMono - works for a bit then gets an out of bounds error (512 mb).
    • SpawnAndRemove - works for a bit then gets an out of memory error (1024 mb).
    • Subscene - still empty?
    It's a step forward but still buggy, is there a memory leak?

    @UT please add these Editor settings back into the build settings UI for WebGL?
     
    Last edited: Oct 4, 2019
  5. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372



    I followed this tutorial and got it to run fine in Unity itself (thanks to a quick fix provided by a youtube comment). But when publishing for webGl the game runs but nothing moves....
    Has anyone some updates on DOTS and WebGL? I understand that this is not really a priority but I think webGL is the best way to get players and thus feedback. Would love to play around with DOTS there.
     
    Nyanpas, deus0 and duzbot like this.
  6. JakHussain

    JakHussain

    Joined:
    Oct 20, 2016
    Posts:
    318
    Your better bet might be to make a pure DOTS project with project tiny since that's designed for web from the ground up.
     
    Nyanpas and Antypodish like this.
  7. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    256
    It makes way more sense to just build your project with ecs and ship to web and other platforms rather the limit yourself with tiny. Unless your target market is purely for that platform.
    Its a real shame Dots WebGL builds have just been (PostPoned!) like this.
     
    Last edited: Aug 27, 2020
    Nyanpas likes this.
  8. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    WebGL builds never worked on mobile, so there is that, and they were really heavy.

    If your web build is over 100 mb, it's much better to do an app and link it on a website than running it in a browser sandbox anyway.
     
  9. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372

    That leaves out uploading to sites like newgrounds, which imo is still the best way for beginners to get feedback. When people have to download it, you get a lot less plays and comments. You can upload a crappy game made in a few days and get a few thousand plays along with ratings and comments. Try that on the play store....

    Unfortunately WebGL itself limits quite a lot of stuff. I was trying to get VFX graph to work, but right now it seems impossible since WebGL doesn't support compute shaders. And since almost no professional developers/studios focus on webGL, I can understand that Unity doesn't invest it's resources into making things work in WebGL.

    Somehow I still have slight hope for ECS on WebGL....
     
    Rallix, deus0 and Nyanpas like this.
  10. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    406
    I agree with all the points made about WebGL being an excellent entrypoint for new gamers. The archaic distribution model of a huge dinosaur-sized download needs to go. Stream the content you need when you need it and decide to keep it if you want it, gradually downloading the game as you play it.

    Web is the future.
     
    davtam and deus0 like this.
  11. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    992
    I agree with the WebGL being great for beginier developper to publish easily game, it's also a great format for GameJams, which if suportted properly could give a bit more wind in the DOTS sails I think.

    As to download a game as you play it, I believe that i't's the purpose of the adressable package.
     
    deus0 and Nyanpas like this.
  12. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    256
    Also, im a big fan of removing the default unity packages for my dots project since its entirely dots. However some of the new packages rely heavily on those packages. It's gotten better but there's still issues with removing all the default packages while using the new DOTS package (Relies on XR, VR, UI, Physics and Animation modules for minor things)
    I'm waiting for WebGL Dots support, but I can't find any ETA's on it. Anyone know? :) Im using Hybrid Renderer, Universal RP and Input System.
    Edit: I found out somewhere that Unity will take roughly a year before we get the goods. It's hard for a new indie dev to get people to play games without it though like others have said!
     
    Last edited: Aug 27, 2020
    shotoutgames and andyman404 like this.