31 lines
830 B
C#
31 lines
830 B
C#
|
using UnityEngine;
|
|||
|
|
|||
|
namespace HK
|
|||
|
{
|
|||
|
public interface IResourceManager
|
|||
|
{
|
|||
|
T Load<T>(string assetPath) where T : Object;
|
|||
|
GameObject LoadGameObject(string assetPath);
|
|||
|
}
|
|||
|
|
|||
|
internal class ResourcesManager : ManagerBase<ResourcesManager>, IResourceManager
|
|||
|
{
|
|||
|
public T Load<T>(string assetPath) where T : Object
|
|||
|
{
|
|||
|
var o = Resources.Load<T>(assetPath);
|
|||
|
return o;
|
|||
|
}
|
|||
|
|
|||
|
public GameObject LoadGameObject(string assetPath)
|
|||
|
{
|
|||
|
throw new System.NotImplementedException();
|
|||
|
}
|
|||
|
|
|||
|
public GameObject LoadGameObject(string assetPath,Transform parent = null)
|
|||
|
{
|
|||
|
var o = Load<GameObject>(assetPath);
|
|||
|
var gameObject = GameObject.Instantiate(o,parent);
|
|||
|
return gameObject;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|