|
Hi, I'm unsure as to how I can write the following as a for loop. Basically this code works perfectly for 3 items, but I want to be able to choose how many items there are on each level which does all of this automatically instead of me having to hard code the number of items each time.
The Best I've come up with so far is;
In the start function I'm trying to link the 1st array item of the script on itemsArray with the 1st variable of ScriptsOnItemsArray. The error in Unity comes out as saying "Cannot convert 'UnityEngine.GameObject' to 'int' on the line that reads;
What am I doing wrong? Thanks!
(comments are locked)
|
|
The index of an array is an Int so your for loop could look like this: Thanks a lot for your answer, it works! But why did my version not work? Is the way I wrote my for loop not the correct way?
Apr 09 '11 at 09:08 AM
Jason H
You used a GameObject instead of an Int variable to assign an element of the array.
Apr 09 '11 at 09:18 AM
efge
Ah ok, thanks a lot.
Apr 09 '11 at 09:53 AM
Jason H
(comments are locked)
|
