How do I set the url for webGL to find Settings.json and Catalog.json

All of our Unity content is sitting on a CDN separate from the website. When we changed to using addressables, it is unable to get the catalog.json or settings.json files, as it is always looking on a local path to the site, not to the CDN.

  1. Is it possible to set the path in JS? (and how)
  2. Is it possible to set the path in Unity’s configuration? (and how)

For the second one, all the remote profile paths are currently using the CDN, and I cannot find another location.

Additionally, the webGL shows up on almost all pages on the site, so a path relative to the page doesn’t work, or we’d have to have duplicate copies of the webGL (or atleast .json files)
for each of the sub paths where the WebGL shows up.

Thanks!

Answer: You do not (though there are work arounds). It is hard coded into the script that the runtime path it uses (on the web) is the current URL.
I attempted to writ a hack, but the management system replaces anything, even before build, just by reentering Unity.
I removed the package from the package manager, and placed it directly in the project, but that also did not work, as it depended on injection and other classes/systems that appear to be internal to Unity Build. :frowning:

I.e. it is not hackable. Settings.json MUST come from the same site.

Alternative work around: On the site, we are setting a redirect. If someone tries to get …/settings.json or …/catalog.json, then we redirect them to the correct URL. Standard web downloads apply and it captures the content from the new location.

This isn’t a perfect solution, as we are adding another network bounce, though that is minimal on timing, but it also requires direct access to the web server configuration.

Setting the Base URL from the HTML page maybe an alternative, but that might be difficult depending on your JS/CSS/other content loading on the same page.

1 Like