Addressable asset path in builds

In play mode, I’m able to load an addressable asset via LoadAssetAsync() by passing in a string path like “Assets/something/file” but this does not seem to work when I build the game since It cant seem to find the directory. Is there something I’m missing? I’ve tried to do something like Addressable.BuildPath+“/Assets/something/file” but that doesn’t work either. (and I use Path.DirectorySeparatorChar in the code, not slashes).

So my question is, for local assets, how do you address the asset by its path?

“Assets/something/file” is not just the path, it is the actual address (it’s the default generated when you make the asset addressable, and you can change it). You cannot load assets by their path, only by their address, so passing that same string in editor or build should work. It also depends what platform you are running on: local directories do not work in WebGL (unless you did a build+run).

yep so as long as I use the address as is, it should work in build, yeah? I think my issue is then related to a json file that isn’t addressable and not in any streaming assets/resources folder so its not being loaded into the build. Because I load my addressables using some relevant info fetched from the json. So to make sure the json files are loaded in the final build, do I just dump them in a streaming assets folder or is there a “better/correct” way?

How are you trying to load the JSON file? If you want to use Addressables to load it, I think you’d either have to mark it Addressable and save a reference to that somewhere, or go to a related asset in your project that IS addressable and add something like a TextAsset reference, and drag the JSON file in there. If you do the latter my understanding is that Addressables would detect the dependency and include it in the bundle as an “implicit” asset, “explicit” being things you mark as addressable and include in a group.

You can check all the items in the bundle to make sure they’re in there by going here


Either way, you shouldn’t have to move the JSON files into another folder. That’s one of the nice things about this package

1 Like

I’ll try the dependency route, thanks!

1 Like