示例#1
0
        public static ScriptableObject GetScriptableObject(string bundleName, string resName)
        {
#if UNITY_EDITOR
            var res = GetEditorAsset <ScriptableObject>(resName, bundleName);
            if (res != null)
            {
                return(res);
            }
#endif
            BundleResources resource = bundleResources[bundleName] as BundleResources;
            return(resource != null?resource.GetScriptableObject(resName) : null);
        }
示例#2
0
        /// <summary>
        /// 获取音频
        /// </summary>
        /// <param name="bundleName">资源包路径</param>
        /// <param name="resName">音频名</param>
        /// <returns>音频对象</returns>
        public static AudioClip GetAudio(string bundleName, string resName)
        {
#if UNITY_EDITOR
            var res = GetEditorAsset <AudioClip>(resName, bundleName);
            if (res != null)
            {
                return(res);
            }
#endif
            BundleResources resource = bundleResources[bundleName] as BundleResources;
            return(resource != null?resource.GetAudio(resName) : null);
        }
示例#3
0
        /// <summary>
        /// 获取Shader
        /// </summary>
        /// <param name="bundleName">资源包路径</param>
        /// <param name="resName">Shader名</param>
        /// <returns>Shader对象</returns>
        public static Shader GetShader(string bundleName, string resName)
        {
#if UNITY_EDITOR
            var res = GetEditorAsset <Shader>(resName, bundleName);
            if (res != null)
            {
                return(res);
            }
#endif
            BundleResources resource = bundleResources[bundleName] as BundleResources;
            return(resource != null?resource.GetShader(resName) : null);
        }
示例#4
0
        /// <summary>
        /// 获取Sprite
        /// </summary>
        /// <param name="bundleName"></param>
        /// <param name="resName"></param>
        /// <param name="fatherResName"></param>
        /// <returns></returns>
        public static Sprite GetSprite(string bundleName, string resName, string fatherResName = null)
        {
#if UNITY_EDITOR
            if (fatherResName != null)
            {
                var res = GetAllEditorAsset <Sprite>(fatherResName, bundleName, resName);
                if (res != null)
                {
                    return(res);
                }
            }
            else
            {
                var res = GetEditorAsset <Sprite>(resName, bundleName);
                if (res != null)
                {
                    return(res);
                }
            }
#endif
            BundleResources resource = bundleResources[bundleName] as BundleResources;
            return(resource != null?resource.GetSprite(resName, fatherResName) : null);
        }