You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
796 B
31 lines
796 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class PrefabManager : Singleton<PrefabManager> |
|
{ |
|
public void Init() |
|
{ |
|
DontDestroyOnLoad(this); |
|
} |
|
public AssetBundleManager assetBundle = new AssetBundleManager(); |
|
#if false |
|
public GameObject PrefabGet(string name) |
|
{ |
|
return assetBundle.GetPrefab(name); |
|
} |
|
#else |
|
Bundle<GameObject> bundlePrefab = new Bundle<GameObject>(); |
|
public GameObject PrefabGet(string name) |
|
{ |
|
GameObject prefab = bundlePrefab.Get(name); |
|
if (prefab == null) |
|
{ |
|
prefab = Resources.Load($"Prefab/{name}") as GameObject; |
|
if (prefab != null) |
|
bundlePrefab.Add(name, prefab); |
|
} |
|
return prefab; |
|
} |
|
#endif |
|
}
|
|
|