Search Unity

WebGL - UnityLoader.instantiateAsync()

Discussion in 'Web' started by DanielSafs, Mar 30, 2019.

  1. DanielSafs

    DanielSafs

    Joined:
    Nov 22, 2016
    Posts:
    11
    Does anybody can show how to implement this feature?

    Unity 2019
    - WebGL: Added UnityLoader.instantiateAsync() which returns a JS Promise.

    I see now that UnityLoader.js has this function,

    upload_2019-3-30_15-57-2.png

    but I have no idea how to use it.

    Could someone help? There is no documentation yet.
     
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
  3. DanielSafs

    DanielSafs

    Joined:
    Nov 22, 2016
    Posts:
    11
    Thanks for the response. I was not able to make it work.

    I tried like this:
    var unityInstance = UnityLoader.instantiateAsync("unityContainer", "Build/janela3d-soma.json", {onProgress: UnityProgress});

    i tried like this:
    var unityInstance = UnityLoader.instantiateAsync("unityContainer", "Build/janela3d-soma.json", {onProgress: UnityProgress}).then(function(value) {
    console.log(value);
    });

    and I tried like this:
    var unityInstance = UnityLoader.instantiateAsync("unityContainer", "Build/janela3d-soma.json", {onProgress: UnityProgress});

    unityInstance.then(function(value) {
    console.log(value);
    });


    Same result for all of them. It loads until 90% and stops, no erros, but I got a message saying my page was making the webbrowser slower.

    Any suggestion on how to use this function?
     
  4. DanielSafs

    DanielSafs

    Joined:
    Nov 22, 2016
    Posts:
    11
    Help please?
     
  5. PushoN

    PushoN

    Joined:
    Jul 5, 2012
    Posts:
    16
    Same issue for me, it doesnt work at all.
     
  6. DanielSafs

    DanielSafs

    Joined:
    Nov 22, 2016
    Posts:
    11

    I was talking to the support team and they said the following:

    UnityLoader.instantiateAsync is not related to the described issue (load WebGL windows assyncronously). It is related to the instantiation of the WebAssembly module and not instantiation of the scene (in fact, this function is no longer used since the latest Emscripten upgrade and will be removed).

    I think we can forget that this function exists.
     
    PushoN likes this.
  7. PushoN

    PushoN

    Joined:
    Jul 5, 2012
    Posts:
    16
    Thank you!
     
  8. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    91
    Forgive the NecroPosting... but can someone please help me with this...

    I just built my WebGL project using 2019.4 and then when I try to load it I get this:


    I did not ask for any Tasks to be created anywhere and yet there it is and now my entire project just refuses to load because I am getting this error. How do I make it NOT use instantiateAsync?

    Surely there must be a way to make working WebGL builds in 2019.4 ?