public void CheckForAggro() { Collider[] colliders = Physics.OverlapSphere(transform.position, allyAggroDistance); for (int i = 0; i < colliders.Length; i++) { AICharacter aiCharacter = colliders[i].GetComponent <AICharacter>(); if (aiCharacter != null) { StateController otherStateController = aiCharacter.GetComponent <StateController>(); if (otherStateController.target != null) { Aggro(otherStateController.target); } } } }