Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     toolbar = ToolbarManager.instance;
     toolbar.itemChangedCallback += UpdateUI; //Event that triggers UpdateUI
     toolbarSlots = itemsParent.GetComponentsInChildren <ToolbarSlot>();
     textMesh     = GetComponentsInChildren <TextMeshProUGUI>();
     UpdateTMP();
     UpdateUI();
 }
        public static ToolbarManager instance; //static variable is shared by all instances of a class

        /// <summary>
        /// setting the instance equal to this particular component
        /// </summary>
        private void Awake()
        {
            items = new Item[space];

            //proof that there is only one instance otherwise warn us
            if (instance != null)
            {
                Debug.LogWarning("More than one instance of ToolbarManager found!");
                return;
            }
            instance = this;
        }