update
This commit is contained in:
27
Assets/Scripts/Manager/CustomPrefabsCollection.cs
Normal file
27
Assets/Scripts/Manager/CustomPrefabsCollection.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
[CreateAssetMenu(fileName = "BasePrefabsCollection", menuName = "Ichni/CustomPrefabsCollection", order = 0)]
|
||||
public class CustomPrefabsCollection : SerializedScriptableObject
|
||||
{
|
||||
public string themeBundleName = "theme_bundle_name_here";
|
||||
public Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();
|
||||
|
||||
public GameObject GetPrefab(string prefabName)
|
||||
{
|
||||
if (Prefabs.TryGetValue(prefabName, out GameObject prefab))
|
||||
{
|
||||
return prefab;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Prefab '{prefabName}' not found in {themeBundleName} collection.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user