Hi all! I’ve had a published WebGL build hosted in a subfolder of our website and working flawlessly for a long time. During that time, we only used the StreamingAssets folder for one BuildProperties file, and it was just a version / BuildGUID text file used by the hosting website.
My project structure looks something like this:
The Unity build lives in the /App folder, here:
When we decided to start using Addressables, the “aa” folder also became part of the StreamingAssets folder. This is where we began running into problems: If my build is located in a subfolder, like “App”, the Addressables system isn’t able to retrieve the catalog.bin or any other StreamingAssets files.
After investigating further, it looks like Unity always expects the build to exist at the root of any website, as the
Application.streamingAssetsPath property always returns “mywebsite.com is available for purchase - Sedo.com” at runtime, regardless of where the build is located.
Basically, Unity appears to be using Absolute pathing to get the StreamingAssets folder, rather than Relative pathing to say “get my sibling folder, the StreamingAssets folder”
Which brings me to my final question: Is there some way to have the Application paths adjust to where the build is going to be located, even if it has to be defined at compile-time?
Update: If I place just the StreamingAssets folder in the project’s root and leave the rest of the build in the App folder, it will find the aa folder no problem, because the absolute path will line up again. I’d like to avoid doing this, though, because it muddies our folder structure and would likely be an easily forgotten step when we update the build.
Thanks for the quick reply! That certainly sounds like what I’m looking for. Unfortunately, I won’t be able to test this until tomorrow morning, but I’ll let you know as soon as I’m able to check it out.
sweeet - which one btw? one thing you can do of course is edit the whole base template so it always includes the build url etc, or whatever… maybe even submit it as a bug as a bug in the template because as you say its expecting /StreamingAssets
We handle creating the UnityInstance slightly differently than the default html template, but still pass in the same config object, so I hard-coded the “streamingAssetsUrl” to “App/StreamingAssets”. Since there was no leading or trailing slash, I kept the same pattern. Seems to work like a charm!
I agree this could be considered a bug, or, at the very least, should be better documented. I must’ve searched the documentation and forums for hours without any luck before finally creating this thread.