コード例 #1
0
        /// <summary>
        /// 获取资源信息
        /// </summary>
        public static AssetBundleInfo GetAssetBundleInfo(string location)
        {
            if (_isInitialize == false)
            {
                throw new Exception($"{nameof(AssetSystem)} is not initialize.");
            }

            if (SimulationOnEditor)
            {
#if UNITY_EDITOR
                string          assetPath  = AssetPathHelper.FindDatabaseAssetPath(location);
                AssetBundleInfo bundleInfo = new AssetBundleInfo(assetPath, assetPath);
                return(bundleInfo);
#else
                throw new Exception($"AssetSystem simulation only support unity editor.");
#endif
            }
            else
            {
                if (BundleServices == null)
                {
                    throw new Exception($"{nameof(BundleServices)} is null. Use {nameof(AssetSystem.Initialize)}");
                }

                string assetPath  = AssetPathHelper.CombineAssetPath(LocationRoot, location);
                string bundleName = BundleServices.GetAssetBundleName(assetPath);
                return(BundleServices.GetAssetBundleInfo(bundleName));
            }
        }