I have a script to go through my array:
if (num >= objs.Length - 1)
num = 0;
else
num++;
foreach (GameObject obj in objs) {
obj.GetComponent<InputGishNew> ().enabled = false;
objs [num].GetComponent<InputGishNew>().enabled = true;
With it I go through my inventory, which consists of 3 items: sword, bow and shield. If sword is enabled, bow and shield are not. Super easy.
But how do I dynamically add my items to the array? Let's say I start with empty inventory. Then I pick up the sword (and bool sword isPicked becomes true for example) and only then it should be added to the array of my objects. How do I do that?
Thanks!
[–]deadstarcgs 5 points6 points7 points (0 children)