Downloads

< Back to downloads
Version:
1.0
Format:
Unity package
Dependencies:
BGDatabase (v. >= 1.6), Addressables

Description

Support for Unity's Addressables system (BGDatabase version >= 1.5.11 is required). This package adds 2 Addressables loaders for all Unity asset fields.

Setup:

  1. Use Unity version > 2018.2
  2. Install Unity's addressables package via package manager
  3. Install latest BGDatabase
  4. Install this package
  5. Create your own database as described here
  6. Create a table with any of the Unity assets field and set loader=Addressables or loader=AddressablesByGuid (while creating a field or via gear icon afterwards)
  7. [Important] Before building your application for the target platform, you need to ensure you built Addressables, cause Unity does not build Addressables automatically. Choose Window->Asset Management->Addressables->Groups and then Build->New Build->Default Build Script

Loaders type:

  1. Addressable: asset address is stored as database value in human readable form. Cons: you can not change address after value was assigned to database
  2. AddressableByGuid: asset Guid (from meta file) is stored as database value. Cons: Guid is just a set of bytes, it's not readable

How to read values:

  1. Retrieve asset address from database and use this address directly with Addressables system API. Each unity asset field is implementing BGAddressablesAssetI interface, which can be used to read asset address (using method string GetAddressablesAddress(int entityIndex)).
  2. If you use code generation, use Read{FieldName}Async generated methods (BGDatabase version >= 1.5.10 is required)
  3. If you use Playmaker/Bolt, use custom actions (links are at the bottom of this page)
  4. [Legacy, not recommended] Usual method, by reading field value. Assets preloading is required for this method, please see below for more details

This AddressablesQuickStart project has examples for 1 and 4 techniques

If you use Playmaker you can use this custom action. No preloading required.

Preloading [Legacy, not recommended]:

This method is not recommended, cause we concern it may not be 100% robust. Use it at your own risk.

If you access unity field with addressables loader like you normally do (How to read values, method # 4, mentioned above), you need to preload required values, otherwise values will not be resolved successfully (null will be returned). You have full control over which values you want to preload: you can use database values or Addressables system to decide which values to preload.
Preloader script is included into the package(Assets\BGDatabaseAddressables\ScriptsNoDll\BGAddressablesPreloader.cs). It preloads all values from all rows/fields, but you can modify it to preload only required part of the database. Completed() method is invoked after all assets are preloaded.

Tesing if Addressables system setup properly:

Some people experience issues while setting Addressables system up. In this case, use this script to test if Addressables works correctly.

  1. Create empty scene
  2. Attach the script to any GameObject
  3. Assign it's Address parameter to some valid address from your Addressables system
  4. Run the scene and make sure asset was loaded successfully (no exceptions in the console)

Known issues:

  1. [UPD: this bug was fixed in Addressables v. 1.10 ] Addressables packages v.1.8.3-1.9.2 have a bug, preventing loading sprites from SpriteAtlases correctly using atlasAddress[spriteName] syntax (invalid key exception is thrown). If you use sprites with SpriteAtlases and GetAddressablesAddress method (without preloading), the solution would be to downgrade to Addressables v.1.7.5 or upgrade to next version after 1.9.2. More information is available here

Using source code

We provide source code for our plugins, so you can use source code instead of built DLL file or build your own DLL using source code.

Guide for using source code:

  1. While importing plugin package, check the packages with source code only
  2. Import source code packages

Additional downloads:

  1. Example "Quick start" project
  2. Custom action for Playmaker to load assets directly from Addressables (without preloading)
  3. Custom action for Bolt to load assets directly from Addressables (without preloading)

Releases

Version Release date Log
1.0 Sep 19, 2020 Versioning reset (unified plugin infrastructure)
0.1.4 Sep 06, 2020 Cache (for entries in folders) update strategy changed to get rid of GUI freezes
0.1.3 Aug 05, 2020 Folders support
0.1.2 March 06, 2020 Update for BGDatabase v.1.5.6
0.1.1 September 20, 2019 Update for BGDatabase v.1.4
0.1.0 January 09, 2019 Initial release