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. Dismiss Notice

Resolved Addressable not wokring after building

Discussion in 'Addressables' started by HexDog, Jul 16, 2023.

  1. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    51
    Hi, I'm currently experimenting with Addressables. I'm using the default pre-setuped addressable settings and It's just won't work after building my project. Using Unity 2020.3.16f1





    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using UnityEngine;
    4. using UnityEngine.ResourceManagement.AsyncOperations;
    5. using UnityEngine.AddressableAssets;
    6.  
    7. public class AssetLoader : MonoBehaviour
    8. {
    9.     [SerializeField] AssetReference reference;
    10.  
    11.     private IEnumerator Start()
    12.     {
    13.         var handle = Addressables.LoadAssetAsync<GameObject>(reference);
    14.  
    15.         yield return handle;
    16.  
    17.         if (handle.Status == AsyncOperationStatus.Succeeded)
    18.         {
    19.             Instantiate(handle.Result);
    20.             Addressables.Release(handle);
    21.             Debug.Log("Success!");
    22.         }
    23.         else
    24.             Debug.Log("Failed to load!");
    25.     }
    26. }
     

    Attached Files:

    Last edited: Jul 17, 2023
  2. pablobandinopla

    pablobandinopla

    Joined:
    Jul 2, 2021
    Posts:
    97
    you marked this as resolved but you didn't posted the solution? What's the point of using a forum if you don't share...
     
  3. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    51
    Apologize. The solution of this problem is to build the Addresssable content first (Addresable Groups -> Build -> New Build -> Default Build), then build the actual game. I thought this function was automatic, but it's not.
     
    pablobandinopla likes this.
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    There's a setting in editor preferences that governs this.
     
  5. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    51
    Can you show where and which version this feature located? I'm using the Verified 1.16.19 version, and I did not manage to find it.
     

    Attached Files:

  6. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Where all the other editor preferences are: Edit -> Preferences

    upload_2023-7-20_20-6-7.png
     
  7. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    51
    What is your editor version? (Mine is Unity 2020.3.16f1)

     

    Attached Files:

  8. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    I think it's a 2021+ setting.

    The screenshot was from the latest 2021.3 version.
     
    Last edited: Jul 21, 2023
  9. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    51
    Yep, that was the problem. I updated my editor and now its working properly. :D