From 2fc9585797067730f28b03b0727bf05f9deed091 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 12 May 2023 10:32:11 +0800 Subject: + worldline keepers --- .../Assets/Scripts/Managers/ResourceManager.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs (limited to 'WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs') diff --git a/WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs b/WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs new file mode 100644 index 0000000..4b318ca --- /dev/null +++ b/WorldlineKeepers/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 + { + + // 资源根目录是Assets/Bundle/,后续可能会把部分资源移动到streamingAssets目录 + public const string kAssetRoot = "Assets/Bundle/"; + + public T LoadAsset(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 + } + + + + } + +} -- cgit v1.1-26-g67d0