evershade/Assets/Scripts/Managers/PrefabManager.cs

54 lines
1.2 KiB
C#

using UnityEngine;
public class PrefabManager : MonoBehaviour
{
public static PrefabManager Instance;
public GameObject slotPrefab;
public GameObject itemPrefab;
public GameObject hotkeyEntryPrefab;
public GameObject tilePrefab;
public GameObject cropPrefab;
private void Awake()
{
Debug.Log("PrefabManager Awake");
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
public GameObject GetSlotPrefab()
{
Debug.Log("Getting Slot Pefab");
if (slotPrefab == null) Debug.LogWarning("SlotPrefab is null");
return slotPrefab;
}
public GameObject GetHotkeyEntryPrefab()
{
Debug.Log("Getting HotkeyEntry Pefab");
if (hotkeyEntryPrefab == null) Debug.LogWarning("HotkeyEntryPrefab is null");
return hotkeyEntryPrefab;
}
public GameObject GetItemPrefab()
{
return itemPrefab;
}
public GameObject GetTilePrefab()
{
return tilePrefab;
}
public GameObject GetCropPrefab()
{
return cropPrefab;
}
}