I have some code where I load a list of IResourceLocation using a label I created for my assets.
My code loads them one at a time as the user clicks an arrow key to loop through them one-by-one.
When I run this in Unity it works flawlessly.
I’ll then do a WebGL build and deploy it in a Docker container that I have hosted on my own machine.
I have console output that indicates that it finds the locations just fine. However, as soon as it calls InstantiateAsync it crashes. In Chrome it gives me the “aw snap” error. Also crashes in Edge with a “This page is having a problem” error. In Firefox it doesn’t crash, but it refuses to process anything after that first call to InstantiateAsync. It starts throwing all sorts of null pointer exceptions as though everything loaded previously just went away.
I’ve also tried doing a call to LoadAssetAsync before InstantiateAsync, but then it crashes on LoadAssetAsync.
I’m using Unity 2020.3.28f1 and addressables 1.18.19
The following is my code:
IEnumerator Start()
{
models = new List<GameObject>();
AsyncOperationHandle<IList<IResourceLocation>> locationHandler = Addressables.LoadResourceLocationsAsync(addressableModelLabel, null);
yield return locationHandler;
resources = locationHandler.Result; //This returns a list of 7 items
StartCoroutine(LoadAddressable(resources[index])); //index initially set to 0
}
private IEnumerator LoadAddressable(IResourceLocation reference)
{
AsyncOperationHandle<GameObject> instHandle = Addressables.InstantiateAsync(reference, transform);
yield return instHandle;
GameObject newObject = instHandle.Result;
string key = resources[refIndex].PrimaryKey;
newObject.name = key;
models.Insert(index, newObject);
}
I’ve attached an image of how my addressables are set up.
The settings for each group has the defaults for Content Packing & Loading and Content Update Restriction. The addressables settings are also on their defaults.
In Other Settings I have Manage Stripping Level set to Low. I also tried it with Strip Engine Code unchecked.
There are no errors in the console. Doing a log dump of chrome also yields no results.