- Home /
Minimap blib icon error
whenever i play the game this error pops up;
IndexOutOfRangeException: Array index is out of range. EnemyAI.Update () (at Assets/Radar/EnemyAI.js:16)
var isChasing : boolean; var seeDistance : float = 50;
function Start () { } function Update () { var gos : GameObject[]; gos = GameObject.FindGameObjectsWithTag("MissionTrigger"); //assumes only one player var thePlayer:GameObject = gos[0]; var dist = Vector3.Distance(thePlayer.transform.position,transform.position);
if(dist<seeDistance){
isChasing= true;
} else {
isChasing=false;
}
} Please help !
Comment
Answer by Fervent · Apr 20, 2011 at 10:04 PM
looks to me like your FindGameObjectsWithTag is returning nothing.
are you sure you tagged something with "MissionTrigger", Check your tags