Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity built for WebGL embedded into a Blazor application won't instantiate properly

Discussion in 'WebGL' started by EiNR, Jan 31, 2019.

  1. EiNR

    EiNR

    Joined:
    May 2, 2018
    Posts:
    2
    Upon trying to run
    Code (JavaScript):
    1.  UnityLoader.instantiate("unityContainer", "Build/TWI.json");
    I receive this message:

    bhelp1.PNG
    The screen seems to have at least partially loaded the unity box, and I can see this in the console:
    bhelp2.PNG


    How do I make sure the "UnityModule" is loaded before I instantiate my container? Or is there a way for me to call "loadModule" from UnityLoader directly?

    Since this is a Blazor web app launched via IIS, the mime types are configured in the Startup, where I added the following code:
    Code (CSharp):
    1. app.UseResponseCompression();
    2.  
    3. var provider = new FileExtensionContentTypeProvider();
    4. provider.Mappings.Add(".wasm", "application/octet-stream");
    5. provider.Mappings.Add(".unityweb", "application/octet-stream");
    6.  
    7. app.UseStaticFiles(new StaticFileOptions
    8. {
    9.     ContentTypeProvider = provider,
    10. });
    One thing I noted was the lack of the ability to add a "remove file extension" option via the configuration. But if there isn't a web.config, how/where do I do that?
     
    Last edited: Jan 31, 2019
  2. EiNR

    EiNR

    Joined:
    May 2, 2018
    Posts:
    2
    I've fixed the problem. The issue was that I had the Build files inside of the wwwroot folder on the Client portion of Blazor instead of the Server portion, and that I was running in IIS Express; so the fix was to not run IIS express, and to move the Build files, as well as deleting the IndexDB cache in my browser.
     
    JaredThirsk and ranirastabout like this.
  3. Magic73

    Magic73

    Joined:
    Jun 23, 2015
    Posts:
    127