| 1234567891011121314151617181920212223242526272829 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SceneResMgr : MonoBehaviour
- {
- [SerializeField] GameObject[] prefabs;
- public static SceneResMgr ins;
- void Awake()
- {
- ins = this;
- }
- void OnDestroy()
- {
- if (ins == this) ins = null;
- }
- public GameObject GetPrefab(string prefabName)
- {
- foreach (var item in prefabs)
- {
- if (item.name == prefabName) return item;
- }
- return null;
- }
- }
|