CRIWARE Unity Plugin Manual  Last Updated: 2025-05-08
[Asset Support] Addressables

Sample description

Overview

cri4u_samples_addon_asset02_addressables.png

This sample uses Addressables to reference resources containing ACB/AWB Assets to play Cues.
Get the prefab from the server and instantiate it by pressing the button in the window.

Attention
For this sample to work properly, the contents of the Addressables must first be built.

Scene information


Middleware CRI ADX (CRI Atom)
Sample Asset Support Sample
Location /cri/unity/samples/UnityProject/Assets/CriAssetSamples/Scenes/
Scene file Scene_02_Addressables.unity
ACF Asset /cri/unity/samples/UnityProject/Assets/CriAssetSamples/Data/DemoProj.acf
ACB Asset /cri/unity/samples/UnityProject/Assets/CriAssetSamples/Data/CueSheet_0.acb
AWB Asset /cri/unity/samples/UnityProject/Assets/CriAssetSamples/Data/CueSheet_0.awb


Description of the program


Get the asset from the prefab list information via Addressables and display the corresponding buttons.
Get the prefab from the server and instantiate it by pressing the button in the window.
A CriAtomSourceForAsset is attached to each prefab, and the Cue Sheet is automatically loaded and the Cue played.

Initialization and modification of the catalog information

After initializing the Addressables in CRI Addressables, call the function to modify the catalog information.

// Check whether the remote catalog exists and initialize the Addressables
obj.GetComponentInChildren<UnityEngine.UI.Button>().onClick.AddListener(() => {
// Discard any previous prefab instance
Unload();
currentInfo = info;
// Can be loaded as a regular Addressable Asset, whether or not it contains CRIWARE assets
info.prefab.InstantiateAsync().Completed += e => {
currentLoaded = e.Result;
UpdateView();
};
});

If the CRI asset has dependencies, the required resources are automatically retrieved as well via the Addressables.
The usual Addressables process is followed (with or without CRI assets).

The AssetBundle cache is disabled on some platforms following Unity specifications.
In this case, the CRIWARE data will be downloaded to a temporary area rather than to the cache.

Clearing the Cache

If the instantiated prefab does not exist when the Clear Cache button is pressed, the cache will be deleted.
If there is an instantiated prefab, this does nothing.

foreach (var info in prefabList.prefabs)
Addressables.ClearDependencyCacheAsync(info.prefab);

The Addressables API clears the actual data cache of the CRI assets in addition to the regular AssetBundle cache.

[Remarks]
For packages before Addressables 1.16.1,
the cache deletion of all Addressables content (including the resources of the CRI Asset) may not work properly.