Firstborn/Library/PackageCache/com.unity.addressables@1.19.19/Documentation~/InitializeAsync.md
Schaken-Mods 7502018d20 Adding Mod Support
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
2023-05-13 22:01:48 -05:00

6.5 KiB

uid
addressables-api-initialize-async

Customizing Addressables initialization

The Addressables system initializes itself at runtime the first time you load an Addressable or make another call to an Addressable API. Call Addressables.InitializeAsync to initialize Addressables earlier (this function does nothing if initialization has already occurred).

The initialization operation performs the following tasks:

  • Sets up the ResourceManager and the ResourceLocators.
  • Loads configuration data created by Addressables from StreamingAssets.
  • Executes any initialization object operations.
  • Loads the content catalog. By default, Addressables first checks for updates to the content catalog and downloads a new catalog if available.

The following Addressables settings can change initialization behavior:

The following runtime properties should be set before the initialization operation starts:

Initialization objects

You can attach objects to the Addressable Assets settings and pass them to the initialization process at runtime. For example, you can create a CacheInitializationSettings object to initialize Unity's Cache settings at runtime. To create your own types of initialization object, create a ScriptableObject that implements the IObjectInitializationDataProvider interface. Use this object to create the ObjectInitializationData asset that Addressables includes with your the runtime data.

Cache initialization objects

Use a CacheInitializationSettings object to initialize Unity's Cache settings at runtime.

To specify the cache initialization settings that the Addressables system should use:

  1. Create the CacheInitializationSettings asset (menu: Assets > Addressables > Initialization > Cache Initialization Settings).

  2. Select the new asset file in the Project panel to view the settings in the Inspector

  3. Adjust the settings as desired.

  4. Open the Addressables Settings Inspector (menu: Window > Asset Management > Addressables > Settings).

  5. In the Initialization Objects section of the Inspector, click the + button to add a new object to the list.

  6. Select your CacheInitializationSettings asset in the File dialog and click Open.

  7. The cache settings object is added to the list.

When Addressables initializes at runtime, it applies these settings to the default Unity Cache. The settings apply to all AssetBundles in the default cache, not just those downloaded by the Addressables system. See Caching for more information about the Unity cache system.

Note

Android applications built with Unity 202.1 or earlier or running on Android 9 or earlier can only play videos from uncompressed AssetBundles. You can use a CacheInitializationSettings object to disable recompression of the cache by disabling the Compress Bundles option.