Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

2019.1

Discussion in 'WebGL' started by Marco-Trivellato, Dec 13, 2018.

  1. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    192
    Strange... but what do you mean by build didn't work? the cache system didn't work or its failed to build? I am currently using 2019.1.0 with both plugins and it is working fine.
     
  2. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    316
    It would crash immediately when the wasm binary loaded. But as noted it worked for us in 2019.1.0, but not 2019.1.3.
     
  3. MikaelKorp

    MikaelKorp

    Joined:
    Jan 9, 2018
    Posts:
    9
    Sorry for this question, but I feel like I really need to ask this.
    Is sub scene streaming and entities suppose to work on latest versions of Unity when targeted WebGL?

    I have tried 1 and half days of doing builds with different settings using the Unity samples project with no luck.
    The project tiny is no go since its 2D based as far as I know. Everything works on editor and standalone. I haven't tested anything else.

    I'm asking because I need to make a proof of concept demo for the company I'm working for and I have 3 weeks to show some cool new stuff with Unity. So far I have not been able to get any of the new ECS or addressable stuff to work with WebGL. Except multi threading seems to build up and work without the mt feature toggled on, which is quite good. Need to test toggled on at some point.

    I was thinking the ability do ECS and sub scene streaming would give advantage over other engines. Add the multi threading and burst compiling and the world could be a better place.

    I have been searching all place, but mostly just talk. So I'm just thinking, if I should stop wasting time on this?
    I guess, if the ECS is not mentioned, then it will not be included in the WebGL build target, but then again shouldn't there be clear indication of that?? Since then its otherwise its just a waste of human resources that could be doing something useful for everyone.

    Maybe a mention in the package manager in which platforms the packages are proven to work.
    Thanks for anyone who can comment on this one.
    Its just one cube with convert to entity script attached. On editor and standalone all fine. WebGL nothing. Not even message.


    upload_2019-6-20_13-31-16.png
    This is what I see in Firefox
    upload_2019-6-20_14-13-14.png
     
    Last edited: Jun 24, 2019
  4. Kristof_Newfort

    Kristof_Newfort

    Joined:
    Feb 21, 2014
    Posts:
    24
    Hi,

    For WebGL, we put all our output files in the same directory. But it seems that there is an issue when you do that. The WASM file is seen as a txt/html instead of application/wasm. It is correctly configured server side, but I did notice following in the loader js:
    Code (JavaScript):
    1. locateFile:function(e){return"Build/".concat("build.wasm"==e?this.wasmCodeUrl:e)}}
    There I see the wasm file NEEDS to be in a 'Build' directory? Is there a option if you don't want this? Can't this be changed so we can use custom names/locations?

    Our game was build with 2019.2.
    Thanks in advance.
     
    Last edited: Aug 23, 2019
  5. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    316
    You can change it (we overrode locateFile to simply return this.wasmCodeUrl). I agree this seemed very silly to me when I was debugging it.
     
    Kristof_Newfort and De-Panther like this.
  6. Kristof_Newfort

    Kristof_Newfort

    Joined:
    Feb 21, 2014
    Posts:
    24
    Thanks for the idea! I ended up using this to try and get the correct directory:
    Code (JavaScript):
    1. locateFile:function(e){return window.location.href.replace(window.location.protocol+"//"+window.location.host,"").concat("/",this.wasmCodeUrl)}
    Problem with only wasmCodeUrl was that I got
    http://my.url.com/build.wasm
    instead of
    http://my.url.com/game/name/build.wasm


    But now I get an other error:
    Uncaught Error: Invalid string. Length must be a multiple of 4


    UPDATE:
    Nevermind, I still had my wasm file in a 'Build' directory to test the standard locateFile function.
     

    Attached Files:

    Last edited: Aug 26, 2019
  7. Kristof_Newfort

    Kristof_Newfort

    Joined:
    Feb 21, 2014
    Posts:
    24
    It is even harder to get wasm streaming working when your files are located elsewhere and injected into the page. I think I can't even hardcode it, because where locateFile is used it will add the url of the page itself. Not the page where the file came from. :(

    It does work with wasm streaming turned off, even without changing locateFile.
    Anyone have any idea on how to do it with wasm streaming?