Got this code from a free turret asset. I’ve got 5 turrets set as enemies, my problem is every time one turret or all turrets get destroyed it throws this MissingReferenceException warning on the console.
Any idea on how to fix this, thanks in advance.
public GameObject[] turrets;
public virtual void Update(){
foreach(GameObject turret in (this.turrets as GameObject[]))
turret.SendMessage("Target", this.transform.position);
}