Exemplo n.º 1
0
        // private IEnumerator DoInit()
        // {
        //     //load asset bundle mainifest
        //     AssetBundle assetBundle = AssetBundle.LoadFromFile(string.Format("{0}/{1}", ResUtility.GetAssetBundlesPath(), ResUtility.ASSET_BUNDLE_FOLDER_NAME));
        //     AssetBundleManifest manifest = assetBundle.LoadAsset<AssetBundleManifest>(ResUtility.ASSET_BUNDLE_MANIFEST);
        // }

        private void LoadAssetFromLocal <T>(AssetId assetId, LoadAssetDelegate <T> onFinished) where T : Object
        {
            T      asset     = null;
            bool   isSuccess = false;
            string errMsg    = string.Empty;

            try
            {
                asset = AssetDatabase.LoadAssetAtPath <T>(assetId.ToString());
            }
            catch (System.Exception e)
            {
                isSuccess = false;
                errMsg    = e.ToString();
            }
            finally
            {
                onFinished(isSuccess, errMsg, asset);
            }
        }
Exemplo n.º 2
0
 public static string ConvertAssetIdToAssetBundlePath(AssetId assetId)
 {
     return($"{GetAssetBundlesPath()}/{assetId.ToString()}");
 }
Exemplo n.º 3
0
 public static string ConvertAssetIdToAssetBundlePath(AssetId assetId)
 {
     return(string.Format("{0}/{1}", GetAssetBundlesPath(), assetId.ToString()));
 }