Does it work if you change this line:
player = GameObject.FindGameObjectWithTag("AIPlayer").GetComponent();
to
player = this.gameObject.GetComponent();
Because this script is on every enemy, I believe it should be able to find the component of itself rather than finding the component using the tags.
↧