I searched around and found that a couple other people were having this same problem. There was no solution posted and I feel that this is an stupid easy fix I am just not seeing it. I’m working the FPS tut slowly getting everything working on the iPhone and encountered this issue with the enemy AI not seeing the player. I feel this is more of a general scripting question and not iPhone specific but I could be wrong. When I hit play in Unity my enemies go about there waypoint pathing and never even temp to look at my player. When I install the game on my iPhone the enemies are the same except that when I jump the enemies see my player only when in the jump. They move to the jump spot and then proceed back to there waypoints. If I loop the jump the enemies seem to be working correctly they are working on there min and max distances and they are firing a rocket at me. I have tried increasing the size of the collider because I thought it just wasn’t tall enough but that didn’t work. I’m pretty sure that I have narrowed the issue down to this chunk of code.
function CanSeeTarget () : boolean {
if (Vector3.Distance(transform.position, target.position) > attackRange)
return false;
var hit : RaycastHit;
if (Physics.Linecast (transform.position, target.position, hit))
return hit.transform == target;
return false;
}
Thanks for the help