Hi, i have a question here about Arrays.
I have two variables
var itemsSlots : GameObject[];
var itemsListArray : Array;
there are three prefab items in itemsSlot which i added in the Inspector.
When i am calling this function
function SomeFunction() {
for(var i = 0; i < itemsSlots.Length; i++) {
print("for loop = " + itemsSlots*); *
-
itemsListArray.Add(i);* -
} *
}
what exactly am i storing in itemsListArray.Add(i) ? Is it only number of items in itemsSlots
in this case 3 ? Therefore i can refer to those objects only as to integers.
And if yes how can i store and retrieve the actual object originally
added in the Inspector.
Cool stuff i got the item in my Debug.Log so i am storing all my items now. In another script i have a function AddItem which is adding this item from loot to inventory and it takes one parameter type of an int. I am calling this function through GetComponent and i tried to use a List as a parameter but it did not work, i changed List to a GameObject and it seems to work now. Great help, thank you
– TrewSx