using UnityEngine; public class ResourceManager { public T Load(string path) where T : Object { return Resources.Load(path); } public GameObject Instantiate(string path, Transform parent = null) { GameObject prefab = Load($"Prefabs/{path}"); if (prefab == null) { Debug.Log($"Failed to load prefab : {path}"); return null; } GameObject go = Object.Instantiate(prefab, parent); int index = go.name.IndexOf("(Clone)"); if (index >= 0) { // go.name = go.name.Substring(0, index); go.name = go.name.Remove(index); } return go; } public void Destroy(GameObject go) { if (go == null) { return; } Object.Destroy(go); } }