Downloads

< Back to downloads
Version:
1.2
Format:
Unity package
Dependencies:
BGDatabase, Addressables

Description

Support for Unity's Addressables system (BGDatabase version >= 1.5.6 is required). It 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 Unity assets fields and set loader=Addressables or loader=AddressablesByGuid via gear icon

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 again
  2. AddressableByGuid: asset Guid is stored as database value. Cons: Guid is just a set of bytes, it's not readable

How to read values:

  1. [Legacy] Usual method, by reading field value. Assets preloading is required for this method, please see below for more details (not recommended)
  2. Instead of reading field value the usual way, you can retrieve asset address from database and use this address directly with Addressables system. No preloading is required in this case. Each unity asset field is implementing BGAddressablesAssetI interface, which can be used to read asset address (using method string GetAddressablesAddress(int entityIndex)).

We recommend method #2, cause it does not involve running additional code(preloading) and it's as robust as Addressables system is.

This AddressablesQuickStart project has examples for both techniques

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

Preloading [Legacy, not recommended]:

If you access unity field with addressables loader like you normally do (How to read values, method # 1, 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. 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

Releases

Version Release date Log
1.2 March 06, 2020 Update for BGDatabase v.1.5.6
1.1 September 20, 2019 Update for BGDatabase v.1.4
1.0 January 09, 2019 Initial release