I have a gui but how do I do things such as picking up and storing items in the inventory gui and being able to use them?
Also, how do I draw the grid in the window for my inventory? I have seen tutorials for this but I have a draggable window and I don’t understand how to get the grids in it.
Please do not link me to a pre-made inventory. I do not want that, I want to make my own but I need a little help or a tutorial.
var inv = new Array(35);
function Awake() {
var gos = GameObject.FindGameObjectsWithTag("Item");
for (var go : GameObject in gos) {
var distanceToMe : float = Vector3.Distance(transform.position, go.transform.position);
if(distanceToMe < range)
inv.Add(go);
print(inv[0]);
}
}
This is what I have so far but it doesn’t print that there is anything in the array. I’m not sure what I’m doing wrong and I still don’t know how to make it add to inventory or how I would be able to add it to the world again.
I had made a inventory script before,I think the first thing you need is the a 3d model prefabs these are the model of the weapon,or so then these prefab had a item script in which it store item value like cost, item name and so on then you create a inventory script in which you store all these item and use the item script in the inventory script