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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Get a dll to work in WebGL

Discussion in 'Web' started by saifshk17, Mar 1, 2023.

  1. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    487
    I have a dll file that I am using inside Unity and it works when I reference it in Windows build. However when I try make a WebGL build, the build fails because of the dll. How do I make the dll support WebGL as well?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,298
  3. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    487
    But is there a way that I can edit my dll file to support webgl platform?
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,298
    When you say „my DLL“ and by that you mean that you created that DLL file, then possibly. As long as the above is true. If you got that DLL from some place and it isn‘t working and there is no explicit mention of „supports Unity WebGL“ then no, absolutely no, it will not work.
     
  5. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    487
    yeah you are right. I have created this dll. It already is supported on Windows platform. Just have no clue on how to make this possible on WebGL as well.
     
  6. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,298
    Throw the code of that DLL into the project itself and remove the DLL. Then check if the build works. If it doesn't, you may get a better error message I hope.

    But if you use namespaces, classes or other DLLs (ie Windows API native calls like FileBrowser) in the DLL that aren't available in Unity scripting and that was the reason to make that DLL, then it's just not going to work. WebGL (browser in general) is a restricted platform, more so than any other including iOS and UWP.