ItemContainer.cs singleton
This commit is contained in:
parent
6836367207
commit
b9030174b6
1 changed files with 14 additions and 0 deletions
|
|
@ -4,6 +4,20 @@ using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ItemContainer : MonoBehaviour {
|
public class ItemContainer : MonoBehaviour {
|
||||||
|
#region Singleton
|
||||||
|
|
||||||
|
public static ItemContainer Instance;
|
||||||
|
|
||||||
|
private void Awake() {
|
||||||
|
if(Instance != null) {
|
||||||
|
Debug.LogWarning("More than one instance of ItemContainer found");
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public Item[] allItems;
|
public Item[] allItems;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
public Item GetItemByName(String name) {
|
public Item GetItemByName(String name) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue