private static void CallLoadAssetSuccess(AssetAccessor assetAccessor)
 {
     try
     {
         assetAccessor.CallbackSet.OnSuccess?.Invoke(assetAccessor, assetAccessor.Context);
     }
     finally
     {
         assetAccessor.ResetCallbacks();
     }
 }
 internal void AddAccessor(AssetAccessor assetAccessor)
 {
     if (Status == AssetCacheStatus.Ready)
     {
         CallLoadAssetSuccess(assetAccessor);
     }
     else if (Status == AssetCacheStatus.Failure)
     {
         CallLoadAssetFailureOrThrow(assetAccessor, ErrorMessage);
     }
     else
     {
         m_AssetAccessors.Add(assetAccessor);
     }
 }
            internal void UnloadAsset(AssetAccessor assetAccessor)
            {
                if (!ReadWriteIndex.AssetInfos.TryGetValue(assetAccessor.AssetPath, out var assetInfo))
                {
                    var errorMessage = Utility.Text.Format("Asset info for path '{0}' not found.", assetAccessor.AssetPath);
                    throw new InvalidOperationException(errorMessage);
                }

                int resourceGroup = ReadWriteIndex.ResourceBasicInfos[assetInfo.ResourcePath].GroupId;

                if (m_Owner.ResourceUpdater.GetResourceGroupStatus(resourceGroup) != ResourceGroupStatus.UpToDate)
                {
                    throw new InvalidOperationException(Utility.Text.Format(
                                                            "Asset '{0}' cannot be used until resource group '{1}' is done updating.",
                                                            assetAccessor.AssetPath, resourceGroup));
                }

                m_AssetAccessorsToRelease.Add(assetAccessor);
            }
                private static void CallLoadAssetFailureOrThrow(AssetAccessor assetAccessor, string errorMessage)
                {
                    var callbackSet = assetAccessor.CallbackSet;

                    if (callbackSet.OnFailure != null)
                    {
                        try
                        {
                            callbackSet.OnFailure(assetAccessor, errorMessage, assetAccessor.Context);
                        }
                        finally
                        {
                            assetAccessor.ResetCallbacks();
                        }
                    }
                    else
                    {
                        assetAccessor.ResetCallbacks();
                        throw new InvalidOperationException(errorMessage);
                    }
                }
 private static void CallLoadAssetProgress(AssetAccessor assetAccessor, float progress)
 {
     assetAccessor.CallbackSet.OnProgress?.Invoke(assetAccessor, progress, assetAccessor.Context);
 }
 internal bool RemoveAccessor(AssetAccessor assetAccessor)
 {
     return(m_AssetAccessors.Remove(assetAccessor));
 }