I was just trying to make a cube or a capsule to follow me, as a zombie game. I assigned the AI script to the cube and capsule then I made a prefab of the cube and capsule. And I cannot assign the Target to the script.
The Script AI is this:
#pragma strict
import UnityEngine.AI;
private var theAgent: NavMeshAgent;
var Target: Transform;
function Start ()
{
theAgent= GetComponent.();
}
function Update ()
{
theAgent.SetDestination(Target.position);
}
And i cannot assign the Target when is a prefab.
↧