Survival Inventory Pro - Add Item to Inventory

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:

I feel pain about this. Write this instead:

public Text woodText;
public int woodItems;
public Text stoneText;
public int stoneItems;
1 Like

Lol, Ok

Bump

You should be contacting the author of the asset about this.

Also, if AddItemToInventory is a script that is part of the asset itself (an asset you already said you had to pay for), you have no business posting their code on here without the author’s permission.

I’m sorry, THe code wont work with just that script and the author is inactive.

Bump