Hello! So I bought this asset on the asset store and I’ve set it up but I am trying to setup my resource manager (Below) With my Inventory System. There’s a Script AddItemToInventory that could work but I don’t quite understand it. Any help would be appreciated. Thanks!
Resource Manager:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ResourceManager : MonoBehaviour {
public Canvas canvas;
public Text wood;
public int Wood;
public Text stone;
public int Stone;
public void AddWood(int cnt){
Wood += cnt;
wood.text = Wood.ToString(); // yes, I changed the variable name, but you can use whatever you prefer.
}
public void AddStone(int cnt){
Stone += cnt;
stone.text = Stone.ToString(); // yes, I changed the variable name, but you can use whatever you prefer.
}
public static ResourceManager instance;
void Awake() {
if(instance == null) instance = this;
else if(instance != this) Destroy(gameObject);
}
}
AddItemToInventory: