I have an array of 10 objects with the same script attatached to each, I want to disable/enable them all one by one but I can’t seem to find the solution to do it correctly? what I have:
public GameObject[] enemies;
void Update(){
enemies = GameObject.FindGameObjectsWithTag("Enemy");
}
// Somewhere else called from anohter script:
public void CastScore(string comboAdd){
foreach(GameObject Enemy in enemies){
enemies.GetComponents<Enemy>().enabled = false;
}
//other code non related
}
I thought it would be as simple as that but it’s not really working and the things I’ve tried aren’t either.
Thanks.