Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Addressables don't work on windows build

Discussion in 'Addressables' started by Deleted User, Jul 15, 2019.

  1. Deleted User

    Deleted User

    Guest

    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:
    464
    unity_bill likes this.