- Home /
How to set up a gui text box to count inventory items?
I have items scattered across the map on my game, and when you pick them up i have a script with an array that adds the items to an inventory. My question is, can i use the gui in unity to have a textbox show up that will actively show a counter showing how many of the items are in the inventory?
What kind of data structure are you using to hold your inventory? Chances are, it already has some kind of counter on it!
Answer by Peter G · Oct 28, 2011 at 01:33 AM
How about:
guiText.text = inventoryArray.Length.ToString();
You need to fill in a few spots though. You need to get a reference to the inventory array before you can access it. And you might need a reference to guiText too depending where you put this script. :)
Your answer
Follow this Question
Related Questions
How To Make A Numeric Inventory System? 0 Answers
using c# script to open/close GUI window 1 Answer
Equipting a Item/Weapon 1 Answer
GUI.Window write elements by pages 0 Answers