Move assets from the Resources system
If your project uses the Resources system to load assets, you can migrate those assets to the Addressables system:
- Make the assets Addressable. To do this, either enable the Addressable option in each asset's Inspector window or drag the assets to groups in the Addressables Groups window.
- Change any runtime code that loads assets using the
ResourcesAPI to load them with theAddressablesAPI. For more information, refer to Load asset references. - Add code to release loaded assets when no longer needed.
If you keep all the former Resources assets in one group, the loading and memory performance is equivalent.
When you mark an asset in a Resources folder as Addressable, the system automatically moves the asset to a new folder in your project named Resources_moved. The default address for a moved asset is the old path, omitting the folder name. For example, your loading code might change from:
Resources.LoadAsync\<GameObject\>("desert/tank.prefab");
to:
Addressables.LoadAssetAsync\<GameObject\>("Resources_moved/tank.prefab");.
Update Resources code
You might have to implement some functionality of the Resources class differently after modifying your project to use the Addressables system.
Replace Resources.LoadAll
Previously, if you had assets in a folder named Resources/MyPrefabs/, you could run Resources.LoadAll\<SampleType\>("MyPrefabs") to load every asset of type SampleType in that folder. To get the same result with Addressables:
Rename or move the
Resources/MyPrefabsfolder out of anyResourcesfolder (Addressables ignores assets that remain under aResourcesfolder path) — for example toAssets/MyPrefabs.In the Project window enable the Addressable checkbox on the folder itself (not each file individually). This makes every asset under the folder Addressable, addressed as
<folder address>/<relative path>.Update any keys used for loading. If you move Resources/MyPrefabs/ into Assets, you'll need to change the loading key to Assets/MyPrefabs. It should exeactly match what is listed in the Addressables Group window.
Confirm Include Folder Keys in Catalog is enabled on the group's Content Packing & Loading schema (enabled by default). This makes the folder's own address load every asset inside it.
Replace the load call:
// Before var prefabs = Resources.LoadAll<SampleType>("MyPrefabs"); // After var handle = Addressables.LoadAssetsAsync<SampleType>("Assets/MyPrefabs", prefab => { /* use prefab */ }); await handle.Task; // or, to get the list of locations first: var locations = await Addressables.LoadResourceLocationsAsync("Assets/MyPrefabs", typeof(SampleType)).Task;Release the handle when the assets are no longer needed. Refer to Unloading Addressable assets.
If you need finer-grained grouping than "everything in one folder" (for example, a subset of files scattered across folders), use Addressable labels instead. A label behaves the same way (one key, many assets) but isn't tied to folder structure.