mergemilitary/Assets/Scripts/Core/ResourceManager.cs

20 lines
507 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UObject = UnityEngine.Object;
public class ResourceManager : D_MonoSingleton<ResourceManager>
{
private Dictionary<string, UObject> mResDic = new Dictionary<string, UObject>();
public T LoadRes<T>(string pPath) where T : UObject
{
if (!mResDic.ContainsKey(pPath))
{
mResDic[pPath] = Resources.Load<T>(pPath);
}
return mResDic[pPath] as T;
}
}