Description
Adds assets loaders for YooAsset build system.Setup
- Install BGDatabase, Scriptable Build Pipeline, YooAsset and this plugin
- Select you addressing scheme. There are 2 different database asset loaders (YooAssets and YooAssetsWithAddress), which can not be used simultaneously- you need to pick one and stick to it. Read the section below ("Which loader to use") for more details
- Include assets to YooAsset build system by using "YooAsset->AssetBundle Collector" menu
- After assets were added to YooAsset build system - you can assign them to the asset fields with YooAssets or YooAssetsWithAddress loaders
- In runtime, you need to initialize YooAsset system first before accessing database asset fields. Read "Initializing YooAsset in runtime" section below for more details
Which loader to use
There are 2 different YooAsset loaders, which are not compatible and can not be used simultaneously- you need to pick one before assigning database fields and stick to it. Each loader has its own limitations you need to be aware of.
Feature | YooAssets | YooAssetsWithAddress |
---|---|---|
How to set up |
"Enable Addressables" toggle should be off in YooAsset->AssetBundle Collector window |
"Enable Addressables" toggle should be on in YooAsset->AssetBundle Collector window |
Limitations |
This loader uses full asset path as asset ID- so you can not change it without losing assigned database value |
This loader uses generated token as asset ID, which include asset file name and optionally some other data. There is a setting, which allows to configure how asset ID is composed. You can not change this setting or the data, included to the asset ID without losing assigned database value |
Local Unity Editor locations cache
We keep local cache of all YooAsset assets locations while working in Unity Editor. Sometimes this cache is updated automatically, but sometimes this cache needs to be updated manually. So after you changed something in YooAsset settings (YooAsset->AssetBundle Collector window) by including or excluding assets - sometimes you need to update our cache manually - so if something does not work properly - updating the cache is the first thing to try
Initializing YooAsset in runtime
YooAsset is not initializing on demand, you need to explicitly initialize it before accessing database asset fields. Here is an example code how to do it:
using System.Collections;
using UnityEngine;
using YooAsset;
public class YooAssetLoader : MonoBehaviour
{
private void Awake() => StartCoroutine(Init());
private IEnumerator Init()
{
yield return YooAssets.InitializeAsync(new YooAssets.OfflinePlayModeParameters
{
LocationServices = new DefaultLocationServices("")
});
//initialized ok
}
}
For more details, see this example class