using System.Collections; using System.Collections.Generic; using UnityEngine; #if UNITY_EDITOR using UnityEditor; #endif public class ResourceManager : Singleton { Dictionary m_CachedObject = new Dictionary(); public T LoadAsset(string path) where T : UnityEngine.Object { if(m_CachedObject.ContainsKey(path)) { return m_CachedObject[path] as T; } #if UNITY_EDITOR T obj = AssetDatabase.LoadAssetAtPath(path); m_CachedObject.Add(path, obj); #else #endif return obj; } }