Exception: Attempting to use an invalid operation handle when trying to load Addressable scene async

Attempting to load an addressable scene asset using packed assets, but the process keeps failing; with the following errors:

Exception encountered in operation Resource<IAssetBundleResource>(defaultlocalgroup_unitybuiltinshaders_4751764e89112362a9cfa2c511628540.bundle): Object reference not set to an instance of an object

Exception encountered in operation Dependencies: Object reference not set to an instance of an object
UnityEngine.ResourceManagement.AsyncOperations.GroupOperation:OnOperationCompleted(AsyncOperationHandle)
DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.AsyncOperation:InvokeCompletionEvent()
Exception: Attempting to use an invalid operation handle
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_InternalOp () (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:306)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_Result () (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:366)
UnityEngine.ResourceManagement.ResourceProviders.SceneProvider+SceneOp.Execute () (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/ResourceProviders/SceneProvider.cs:58)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:461)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].<.ctor>b__33_0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle o) (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:112)
DelegateList`1[T].Invoke (T res) (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.Debug:LogException(Exception)
DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/Util/DelegateList.cs:73)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.12.0/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:15)

here’s my loading code:

Addressables.LoadSceneAsync(AddressableScene, LoadSceneMode.Additive).Completed += obj =>
            {
                if (obj.Status == AsyncOperationStatus.Succeeded)
                {
                    handle = obj;
                    OnSceneLoaded?.Invoke(this);
                }
                else
                {
                    Debug.LogError($"Error Loading scene {AddressableScene.Asset.name }: {obj.OperationException} ");
                    OnSceneLoadFailed?.Invoke(this);
                }
            };

I can see that the shader bundle exists; but the operation keeps failing for some reason.

This all works in asset mode in the editor of course :slight_smile:

I finally figured out what was going on here; and I think it might be a bug tbh.

So, I have a scene group, with all the scenes that I want to load/unload in them. There is nothing in the default local group. When I build the addressables with the scenes it automatically created that “defaultlocalgroup_unitybuiltinshaders_4751764e89112362a9cfa2c511628540.bundle” which I know is needed for the scenes, but it has associated it with the default group - which has nothing in it, and thus fails when it was trying to load the ‘dependencies’ from it.

Am I doing something wrong, or should the unity builtinshaders group not be associated with the scenes group and not the empty default group?

popping one single object into the default group and everything worked no problem.

2 Likes