As it stands now I have 20 GuiTexture GameObjects representing 20 slots in my bag. Is it possible to make an array some how in C# then add the 20 gameobjects to that array or is there a way to Search for a game object with a particular name then add it via script?
n/m GameObject.Find is a nifty lil thing mmmhhhmm lol
GameObject.Find can be slow if you end up using it frequently.
Great if you use it on rare occasion, but try not to use it multiple times per update.
This is what I put in the void Start()
for(int i = 0; i < 20; i++)
{
Slots[i] = GameObject.Find("Slot" + (i + 1));
Slots[i].GetComponent<GUITexture>().enabled = false;
InvSlots[i] = new Item();
InvSlots[i].Empty = true;
}
Yeah, that’s what I would have suggested.
Just wanted to make sure you weren’t doing something crazy in Update.
No not yet. Guess now its time to decide how to store the Items and give items to the player or get items from a box and put it into the players inventory if theres an empty slot.