Enemy clone not following script

I created move spots for my enemies to randomly patrol, but I kept getting an error that my array index is out of bounds. I realized that it wasn’t because of the code but because one of the spawned clones just ignored the move spot gameobjects.

This is how the clones properties are supposed to look like

And then the last clone just ignored the move spots

Did you fill the array manually from the inspector? You will have to fill it from code I would do it in the Start function. There are many ways to do this, your move objects are just transforms, so you can put tags on them and use them to get them all with FindGameObjectsWithTag(string tag); then add them all to the enemies’ MoveSpot array probably with a loop in the Start method in the EnemyController script.