Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    397
    unity_bill likes this.
unityunity