WebGL Addressables Exception
I'm building a WebGL application and i am trying to use Addressables to manage the assets. Unity used 2019.3.0f1 and Addressables version 1.1.10 The code I'm using is a simple reference load that would spawn a prefab.
public class AddressableManager : MonoBehaviour
{
[SerializeField] private AssetReference reference = null;
private void Start()
{
reference.LoadAssetAsync<GameObject>().Completed += AddressableManager_Completed;
}
private void AddressableManager_Completed(AsyncOperationHandle<GameObject> obj)
{
Debug.Log(obj.Result);
if (obj.Result == null) return;
GameObject prefab = Instantiate(obj.Result);
}
}
After I have build the Player Content, the asset loads within the Editor. The materials of the spawned object are pink, but not missing. When I open the application within http://locahost, I'm receiving the following error message:
Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Succeeded' - Chain<GameObject,IResourceLocator>: ChainOperation of Type: UnityEngine.GameObject failed because dependent operation failed
Dependency Exception
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:LogFormat(LogType, String, Object[])
UnityEngine.Debug:LogErrorFormat(String, Object[])
UnityEngine.AddressableAssets.AddressablesImpl:LogException(AsyncOperationHandle, Exception)
System.Action`2:Invoke(AsyncOperationHandle, Object)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:set_OperationException(Exception)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Complete(Object, Boolean, String)
UnityEngine.ResourceManagement.ChainOperation`2:OnWrappedCompleted(AsyncOperationHandle`1)
System.Action`1:Invoke(AsyncOperationHandle`1)
DelegateList`1:Invoke(AsyncOperationHandle`1)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:InvokeCompletionEvent()
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.InvokeCompletionEvent()
UnityEngine.ResourceManagement.ResourceManager:ExecuteDeferredCallbacks()
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
System.Action`1:Invoke(Single)
MonoBehaviourCallbackHooks:Update()
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
For the Profile Settings I tried several changes. First, I used the default Local Build Path en Local Load Path. Second, I tried to change the Load Path to my remove localhost url build location.
Does anyone know why I am receiving this error message and how I could solve it? Thank you in advance.
Answer by Sjors-Thomassen · Dec 05, 2019 at 01:16 PM
When I cleared my cache I could successfully load in the asset. The error message returned when I reload the WebGL index page. So the problem has to do something with using stored addressable data from the cache.
Your answer
![](https://koobas.hobune.stream/wayback/20220612215727im_/https://answers.unity.com/themes/thub/images/avi.jpg)