Search Unity

Addressables don't work on windows build

Discussion in 'Addressables' started by mnarimani, Jul 15, 2019.

  1. mnarimani

    mnarimani

    Joined:
    Mar 27, 2017
    Posts:
    212
    I have this code:

    Code (CSharp):
    1.  
    2.         public static void InstantiateItemObject(
    3.             int itemID,
    4.             Transform parent,
    5.             GameObjectCallback callback = null)
    6.         {
    7.             AsyncOperationHandle<GameObject> asyncHandle = Addressables.InstantiateAsync("g" + itemID, parent);
    8.  
    9.             if (callback == null) return;
    10.  
    11.             asyncHandle.Completed += handle =>
    12.             {
    13.                 if (handle.Status != AsyncOperationStatus.Succeeded)
    14.                 {
    15.                     Debug.LogError($"Failed to instantiate item {itemID} object");
    16.                     return;
    17.                 }
    18.  
    19.                 callback(handle.Result);
    20.             };
    21.         }
    It works in editor, But when I build for windows, nothing happens.
    What's the problem?
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    315
    unity_bill likes this.