(this is within a for loop where x and y change each time, all in all it is run about 200 times and the list has 10 objects)
this works for a while and multiple of each object is spawned.
However, by the second iteration of the script it starts calling an error about not finding the list index.
I tried calling the objects without a list, and the same thing happened where it worked at first but then stopped being able to find the objects from the other layer.
Yes, as I said all the objects in the list are added several times before it stops working so I know the list is calling the right things.
If I add a condition to only add objects if the list is not empty then it will add each multiple times and then stop, claiming the list is now empty. It is as if the objects in the inactive layer simply cease to exist.
From your description it sounds as the list is too short for the number you get. But I’m not sure - " error about not finding the list index" is not really a unique error as you have two lists this can happen (myList and the inactive objects).
I suggest you output some debug information to console:
number chosen
list size
list
Possible causes:
list is not what you expect
number is not what you expect
both are different at the different processing times.
“scene” was referring to “getCurrentScene”, but the current scene changed part way through meaning the inactive objects were no longer in “current scene”.
Thanks for all your help though.