using System.Collections; using UnityEngine; using UnityEngine.Events;
publicclassResourcesManager : BaseManager<ResourcesManager> { ///<summary> /// 同步加载资源,如果是游戏对象就直接实例化,并返回游戏对象 ///</summary> ///<param name="name">资源路径</param> ///<typeparam name="T">资源类型</typeparam> /// 这里的约束是Object(不是object万物之父),Resources读取返回的一定属于这种类型 public T Load<T>(string name) where T : Object { T res = Resources.Load<T>(name); if (res is GameObject) return GameObject.Instantiate(res); else return res; }