blob: 4b318ca452adaae2065aa0667abe88638652ed8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
}
}
}
|