diff options
Diffstat (limited to 'marching/Assets/Scripts/Managers/ResourceManager.cs')
-rw-r--r-- | marching/Assets/Scripts/Managers/ResourceManager.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/marching/Assets/Scripts/Managers/ResourceManager.cs b/marching/Assets/Scripts/Managers/ResourceManager.cs new file mode 100644 index 0000000..4b318ca --- /dev/null +++ b/marching/Assets/Scripts/Managers/ResourceManager.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Collections.Generic; +#if UNITY_EDITOR +using UnityEditor; +#endif +using UnityEngine; + +namespace WK +{ + + public class ResourceManager : Singleton<ResourceManager> + { + + // 资源根目录是Assets/Bundle/,后续可能会把部分资源移动到streamingAssets目录 + public const string kAssetRoot = "Assets/Bundle/"; + + public T LoadAsset<T>(string relativePath) where T : UnityEngine.Object + { +#if UNITY_EDITOR + string path = kAssetRoot + relativePath; + T obj = AssetDatabase.LoadAssetAtPath(path, typeof(T)) as T; + return obj; +#else + return null ; +#endif + } + + + + } + +} |