I’m using the command:
"for (int i = 0; i < CubeSpawner.GetClone(int index); i++)
{
if (CubeSpawner.GetClone*.object == colPlayer)*
{
"
to check for a specific object in a list (this is the command that is not working) and the list is public with the command in Cube spawner: "public static Transform GetClone(int index)
{
return clones[index];
}"
but I don’t know how to get the index like this (so how many objects the list contains).
and how to get a specific object from it (so with )
Add GetCloneCount() to your CubeSpawner class
public static Transform GetClone (int index) {
return clones[index];
}
public static int GetCloneCount () {
return clones.Count;
}
Now you can loop through the list and get each object 1 by 1 like this
for(int i=0;i<CubeSpawner.GetCloneCount(); i++){
Transform clone = CubeSpawner.GetClone(i);
}