I’m doing some tests with the 1.1.10 version of Addressables with Unity 2018.4.4.
I’m trying to load a scriptable object from the addressable system and am getting a rather obtuse error that I’m not quite understanding that I’m wonder if someone could shed some light on. I’ve been able to load the standard asset reference types (Textures, Sprites, etc.).
[CreateAssetMenu(fileName = "DataObject.asset", menuName = "MyMenu/TestDataObject")]
public class DataScriptableObject : ScriptableObject
{
[Serializable]
public class AssetReferenceDataScriptableObject : AssetReferenceT<DataScriptableObject>
{
public AssetReferenceDataScriptableObject(string guid) : base(guid) { }
}
public string someStringData;
public int someIntData;
}
Then I’m setting up a monobehavior with an addressable asset
public class CustomizationController : MonoBehaviour
{
public CustomizationList.AssetReferenceCustomizationList optionsAddressable;
void Start()
{
dataAddressable.LoadAssetAsync().Completed += op =>
{
DataScriptableObject loadedObj = op.Result;
Debug.LogFormat("LoadedDataObject: {0} String: {1} Number: {2}", loadedObj, loadedObj.someStringData, loadedObj.someIntData);
};
}
}
Am I missing something obvious about how to use the API? This style of code works fine for the texture assets is this a limitation with scriptable data objects in the addressable system?
I receive the following errors.
Exception encountered in operation Resource(DataObject.asset): Unknown error in AsyncOperation
UnityEngine.AsyncOperation:InvokeCompletionEvent()
Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result=‘’, status=‘Succeeded’ - Chain<DataScriptableObject,IResourceLocator>: ChainOperation of Type: DataScriptableObject failed because dependent operation failed
Unknown error in AsyncOperation
UnityEngine.ResourceManagement.ChainOperation2:OnWrappedCompleted(AsyncOperationHandle1)
DelegateList1:Invoke(AsyncOperationHandle1) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)
NullReferenceException: Object reference not set to an instance of an object
CustomizationController+<>c.b__8_0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle1[TObject] op) (at Assets/Scripts/CustomizationController.cs:28) DelegateList1[T].Invoke (T res) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.Debug:LogException(Exception)
DelegateList1:Invoke(AsyncOperationHandle1) (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/DelegateList.cs:73)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.1.10/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)