Esempio n. 1
0
    /// <summary>
    /// 从磁盘上加载已经下载过的资源,并显示
    /// </summary>
    /// <param name="fileName"></param>
    private void LoadAssetFromFile(string fileName)
    {
        StorageAssetData data = StorageAssetManager.Instance.LoadAsset(fileName);

        if (data.bundle == null)
        {
            Debug.LogError("Load Bundle " + fileName + " failed!");
            cursor.isBusy = false;
            return;
        }

        try
        {
            GameObject prefab = data.bundle.LoadAsset <GameObject>(data.assetName);

            PrefabUtils.DestroyAllChild(currentSelectBooth.gameObject);

            GameObject obj = PrefabUtils.CreateGameObjectToParent(currentSelectBooth.gameObject, prefab);
        }
        catch (System.Exception e)
        {
            Debug.LogError("Exception! " + e);
        }

        cursor.isBusy = false;
    }