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
  3. Dismiss Notice

Cannot redefine property: asmLibraryArg

Discussion in 'Addressables' started by Cfirzi, Dec 4, 2019.

  1. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    Hello

    I have this error after moving to Addressable Assets tech in my project

    I found the cause of the problem, It is an external jslib plugin (https://github.com/kongregate/Unity-WebGL-Utilities).
    Looks like it's conflicting with 2019.x

    removing this plugin works but I really need it in the project, the code that cause the issue is :
    Code (JavaScript):
    1. if (Module.CachedXMLHttpRequestDisable !== true) {
    2.   if (Module.CachedXMLHttpRequestLoader === true) {
    3.     if (typeof LoadCompressedFile == "function")
    4.       LoadCompressedFile = CachedXMLHttpRequest.wrap(LoadCompressedFile);
    5.     if (typeof DecompressAndLoadFile == "function")
    6.       DecompressAndLoadFile = CachedXMLHttpRequest.wrap(DecompressAndLoadFile);
    7.   }
    8.   Object.defineProperty(Module, "asmLibraryArg", {
    9.     get: function () { return Module.realAsmLibraryArg; },
    10.     set: function (value) {
    11.       if (typeof value == "object" && typeof value._JS_WebRequest_Create == "function")
    12.         value._JS_WebRequest_Create = CachedXMLHttpRequest.wrap(value._JS_WebRequest_Create);
    13.       Module.realAsmLibraryArg = value;
    14.     },
    15.   });
    16. }
    does anyone have a solution for this?
    my thought is that the "asmLibraryArg" property is no longger available in unity 2019 version but I cant find anywhere a replacement for it...

    Thanks
     
  2. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    I found a solution to this issue where you can still use unity 2019 and Unity-WebGL-Utilities plugin

    if you just comment out the problematic if statement :
    Code (JavaScript):
    1. Object.defineProperty(Module, "asmLibraryArg", {
    2.     get: function () { return Module.realAsmLibraryArg; },
    3.     set: function (value) {
    4.       if (typeof value == "object" && typeof value._JS_WebRequest_Create == "function")
    5.         value._JS_WebRequest_Create = CachedXMLHttpRequest.wrap(value._JS_WebRequest_Create);
    6.       Module.realAsmLibraryArg = value;
    7.     },
    8.   });
    9. }
    the plugin will still work and the build will run as usual.
    not sure whats going on there but it is possible that in 2019 Unity take care of this on their side so the plugin still works even tho the property is no longer available