Search Unity

Can't build for webgl after installing usim

Discussion in 'Unity Simulation' started by iosphere, Sep 28, 2020.

Thread Status:
Not open for further replies.
  1. iosphere

    iosphere

    Joined:
    Dec 28, 2019
    Posts:
    13
    Hi,
    My project needs to build for both webgl and for linux so that I can use the usim functionality. However, after installing the usim package, I can't get past this webgl build bug (on the developer cloud), despite pragma city:
    upload_2020-9-27_20-18-28.png
    I have got #ifdef !UNITY_WEBGL around all of my unity simulation using statements and usim code.

    I'm definitely not a package manager expert, so I'm hoping there's some simple place I can type "when building for webgl, please ignore this package". I've googled around for an hour or so with no luck, so I thought you guys could help me.

    Thanks in advance!
    -Io
     
  2. justinagraham

    justinagraham

    Joined:
    Jan 17, 2017
    Posts:
    10
    Hi Io,

    The package com.unity.simulation.capture contains a native plugin for jpeg encoding, due to limitations on the builtin encoder. The errors you are seeing are from the C# code that uses the native plugin, which is only supported on Windows, Mac, and Linux.

    However, if you are using Unity 2019.3 or later, then you can specify a scripting build define USIM_USE_BUILTIN_JPG_ENCODER in player settings. This will use the builtin encoder which as of 2019.3 is thread safe. This won't actually fix the issue above though, because that c# code is still being compiled, and so will still generate the errors above.

    I just created a PR to fix that, and I am putting it through our pipeline to release version 0.0.10-preview.14 later today. The pipeline can take a little while, and so I cannot guarantee it will finish by today, but hopefully it will. I will respond again when it has been released, and then you can update the package in the package manager UI, and specify that build define, at which point your WebGL builds should succeed.

    Thanks
    Justin
     
  3. justinagraham

    justinagraham

    Joined:
    Jan 17, 2017
    Posts:
    10
    Hi @iosphere I just wanted to let you know that the capture package version preview.14 has been released. You can update to this package in the package manager UI under the window menu in the editor.

    Also, don't forget to set the scripting build define USIM_USE_BUILTIN_JPG_ENCODER in Player Settings.

    Please let us know if you have any further issues.

    Thanks
    Justin
     
    Last edited: Sep 28, 2020
    iosphere likes this.
Thread Status:
Not open for further replies.