summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Resources/ResourceManager.cs
blob: b01852a2fe0911e631b2b12fe4fa669372d707f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ResourceManager : Singleton<ResourceManager>
{
	private Dictionary<string, UnityEngine.Object> m_LoadedObjects = new Dictionary<string, Object>();

	public T Load<T>(string path) where T : UnityEngine.Object
	{
		if(m_LoadedObjects.ContainsKey(path))
		{
			return m_LoadedObjects[path] as T;
		}
		T obj = Resources.Load<T>(path);
		m_LoadedObjects.Add(path, obj);
		return obj;
	}

}