adding objects to a builtin array not working?

Hi, I’ve been trying to get an inventory system using a builtin array to store my items, however when I try filling this with empty objects it will not fill it. At all. :expressionless:

Here’s the code I’m using to fill up my array, it gives me no errors, however the array remains empty in the inspector:

var emptySlot : GameObject;
emptySlot = GameObject.FindWithTag("Empty");
var InvArray = new GameObject[25];
var amountOfSlots = InvArray.length;

function Awake()
	for (var i: int = 0; i < amountOfSlots; i++)
		InvArray *= emptySlot;*
  • }*

emptySlot = GameObject.FindWithTag(“Empty”);

I believe this line needs to be in an initializer, and not in your variable declarations. Put it inside Awake before your for loop or in Start.