26 lines
584 B
C#
26 lines
584 B
C#
// using System
|
|
using UnityEngine;
|
|
|
|
public class ResourceManager {
|
|
public T Load<T>(string path) where T : Object
|
|
{
|
|
return Resources.Load<T>(path);
|
|
}
|
|
|
|
public GameObject Instantiate(string path, Transform parent = null)
|
|
{
|
|
GameObject prefab = Load<GameObject>($"Prefabs/{path}");
|
|
if (prefab == null)
|
|
{
|
|
Debug.Log($"Prefab Missing! {path}");
|
|
return null;
|
|
}
|
|
return Object.Instantiate(prefab, parent);
|
|
}
|
|
|
|
public void Destroy(GameObject go)
|
|
{
|
|
Object.Destroy(go);
|
|
}
|
|
}
|