Git Product home page Git Product logo

Comments (5)

thanwah avatar thanwah commented on May 4, 2024

Thank you @asrakan for filing this issue.

@jamcohen, can you please take a look when we're back from holiday next week?

from play-unity-plugins.

jamcohen avatar jamcohen commented on May 4, 2024

Hi @asrakan,

Thanks again for raising this issue. I've got a couple questions that'll help me diagnose the problem.
Could you describe the behavior you're seeing in more detail?
When you call RetrieveAssetBundleAsync, are you checking the returned request over time to see if it succeeds?
Does the status of that request ever change to "Loaded"?
Are there any debug logs you can share?

Best,
Jake Cohen

from play-unity-plugins.

asrakan avatar asrakan commented on May 4, 2024

Actually I am handling the logics, but when there are some certain problems in-game I reset the application so all of the coroutines and my caches are get clean. Due to this, I can't reach the currently active requests I made before which are still loading/loaded, I want to access them.

Here is the my code line;


> ` public IEnumerator DownloadCoroutine(AssetBundleRequest request)
>         {
>             Debug.LogError("dowload coroutine : " + request.AssetBundleData.BundleName);
>             request.TriedCount++;
>             if (request.TriedCount >= MaxPLayServiceAssetDeliveryTryCount)
>             {
>                 request.AssetBundleData.BundleStatu = BundleStatus.Failed;
>                 request?.ErrorCallback(request);
>                 yield break;
>             }
>             try
>             {
>                 if (request.PlayAssetBundleRequest == null)
>                 {
>                     request.PlayAssetBundleRequest = PlayAssetDelivery.RetrieveAssetBundleAsync(request.AssetBundleData.BundleName);
>                 }
>             }
>             catch (Exception ex)
>             {
>                 string errorMessage = "BUNDLE SYSTEM - WILL BE HALTED - Play Service delivery problem. TRY COUNT : " + request.TriedCount + " Error : " + ex.Message + "..Status : " + request.PlayAssetBundleRequest.Status + ". Bundle name : " + request.AssetBundleData.BundleName;
>                 Debug.LogError(errorMessage);
>                 Crashlytics.LogException(new Exception(errorMessage));
>                 GameAnalyticsSDK.GameAnalytics.NewErrorEvent(GameAnalyticsSDK.GAErrorSeverity.Critical, errorMessage);
>                 request.EmptyMonoBehavior.StartCoroutine(HaltRequest(request));
>                 yield break;
>             }
>             yield return new WaitForEndOfFrame();
>             if (BundleDownloadErrorControl(request))
>             {
>                 yield break;
>             }
>             //Waiting for play service to handle reuqest
>             while (!request.PlayAssetBundleRequest.IsDone)
>             {
>                 if (BundleDownloadErrorControl(request))
>                 {
>                     yield break;
>                 }
>                 switch (request.PlayAssetBundleRequest.Status)
>                 {
>                     case AssetDeliveryStatus.Pending:
>                         break;
>                     case AssetDeliveryStatus.Retrieving:
>                         request.AssetBundleData.BundleStatu = BundleStatus.Downloading;
>                         request.DownloadProgress = request.PlayAssetBundleRequest.DownloadProgress;
>                         AssetBundleDownloadPanel.UpdateDataStatic(request.DownloadProgress, request.AssetBundleData.Size, request.AssetBundleData.BundleName, Color.green);
>                         break;
>                     default:
>                         break;
>                 }
>                 request.DownloadProgress = request.PlayAssetBundleRequest.DownloadProgress;
>                 yield return new WaitForEndOfFrame();
>             }
>             if (BundleDownloadErrorControl(request))
>             {
>                 yield break;
>             }
>             else
>             {
>                 //Writing like this to simplfy 
>                 if (request.RequestType < BundleRequestTypes.Load)
>                 {
>                     request.PlayAssetBundleRequest.AssetBundle.Unload(true);
>                     request.AssetBundleData.BundleStatu = BundleStatus.Downloaded;
>                     request.ResultCallback(request);
>                 }
>                 else
>                 {
>                     request.AssetBundleData.Bundle = request.PlayAssetBundleRequest.AssetBundle;
>                     request.AssetBundleData.BundleStatu = BundleStatus.Loaded;
>                     request.ResultCallback(request);
>                 }
>             }
> 
>         }`

from play-unity-plugins.

jamcohen avatar jamcohen commented on May 4, 2024

Ah, I see. So the issue is that you lose the reference to the PlayAssetBundleRequest and then when you call RetrieveAssetBundleAsync you get an exception because thats asset pack request is still in progress.

I'll explore having that method return the active request instead of throwing that exception.

In the meantime could you maintain a dictionary of request keyed by asset pack names? Then, in the catch block for that exception you could reference the last active request stored in the dictionary. Would that work?

from play-unity-plugins.

asrakan avatar asrakan commented on May 4, 2024

Hello, I am basically maintaining the problem for now, but it would be better to have returning active request

from play-unity-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.