loop in start function

Hi,
this is my code:
function Start(){

windowRect=Rect(Screen.width-windowSize.x,Screen.height-40-windowSize.y,windowSize.x,windowSize.y);
for(var i : int = 0; i < numInv; i++){
associatedInventory*=GetComponent(Inventory);*

print(i);
}

}
When i run the scene in console doesn’t is show the variable i.
Why?
greetings Samusam

Most likely because the variable numInv is 0, so the loop executes 0 times. It could also be because the line before throws an exception, aborting the execution before it has a chance to print i.

2 Answers

2

Maybe the getcomponent returns in null.

If that happens it will simply store null at index i in the array. It won't abort execution and not print i.

yes, it was the problem