コード例 #1
0
        /// <summary>
        /// 加载资源
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="abName"></param>
        /// <param name="objName"></param>
        /// <returns></returns>
        private T LoadFormAssetBundle <T>(string abName, string objName) where T : UnityEngine.Object
        {
            //
            T o = default(T);
            AssetBundleReference abr = null;

            if (assetbundleMap.TryGetValue(abName, out abr))
            {
                o = abr.assetBundle.LoadAsset <T>(objName);
            }

            return(o);
        }
コード例 #2
0
        /// <summary>
        /// ab包计数器
        /// </summary>
        /// <param name="name"></param>
        /// <param name="ab"></param>
        private void AddAssetBundle(string name, AssetBundle ab)
        {
            if (assetbundleMap.ContainsKey(name) == false)
            {
                AssetBundleReference abr = new AssetBundleReference()
                {
                    assetBundle = ab
                };
                assetbundleMap[name] = abr;
            }

            assetbundleMap[name].Use();
        }