Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How can I check for catalog updates while my app is running?

Discussion in 'Addressables' started by yoshitaka-arishima, Aug 9, 2019.

  1. yoshitaka-arishima

    yoshitaka-arishima

    Joined:
    Jul 8, 2019
    Posts:
    5
    Hi. My app initializes Addressable on startup.
    After initializing Addressable, how can I check for catalog updates while my app is running?
    And how can I initialize Addressable again?
     
  2. amaike

    amaike

    Joined:
    Mar 6, 2014
    Posts:
    8
    Code (CSharp):
    1.   private void Start()
    2.   {
    3.     Addressables.InitializeAsync().Completed += initialize =>
    4.     {
    5.       Addressables.GetDownloadSizeAsync(s_Key).Completed += updata =>
    6.       {
    7.         long dataSize = updata.Result;
    8.         if (dataSize > 0)
    9.         {
    10.           Addressables.DownloadDependenciesAsync(s_Key).Completed += download =>
    11.           {
    12.             if (AsyncOperationStatus.Succeeded == download.Status)
    13.             {
    14.               OnLoadDone();
    15.             }
    16.             else
    17.             {
    18.             }
    19.           };
    20.         }
    21.         else
    22.         {
    23.           OnLoadDone();
    24.         }
    25.       };
    26.     };
    27.   }
    28.  
    29.   public void Reload()
    30.   {
    31.     Addressables.ReleaseInstance(Addressables.InitializationOperation);
    32.     SceneManager.LoadScene("Main", LoadSceneMode.Single);
    33.   }
    34.  
    35.   void OnLoadDone()
    36.   {
    37.     Addressables.InstantiateAsync(s_Model).Completed += objectData =>
    38.     {
    39.       m_Result = objectData.Result;
    40.     };
    41.   }
    42.  
    43.  

    I tried this code, but the content is downloaded, but the previously cached object is shown again. I would like a re-initialization API to solve this problem.
     
  3. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    amaike likes this.
  4. amaike

    amaike

    Joined:
    Mar 6, 2014
    Posts:
    8