How do Addressables and Unity Package Manager Packages intersect?

I’m working on a UPM package that I would like to re-use internally. It currently makes use of Resources.Load<> to dynamically load prefabs, materials, and other resources. Is there a way for me to use Addressables in a way that automatically plugs into whatever project my UPM package is added to? Can I define my own Addressable group to contain all of my package’s dynamic resources? Can I then have the project automatically add this new Addressable group when my package is added to the project?

What is the correct way for packages to manage/load resources dynamically?


Casey

You can use an editor script to automatically generate an addressable group and assign addresses, and set their update restriction to cannot change post release (to guarantee it’s included in the build, even if the package user doesn’t directly use addressables). The only thing I’m not sure about is how to generate a new addressable settings object if it doesn’t already exist.