UnassignedReferenceException: The variable Target of AI has not been assigned [Error]
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
mport 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.
Answer by Yoshinator2 · Oct 03, 2017 at 04:54 PM
Im not sure but if I were to take a guess, you would need to set theAgent.target = TargetObj;
Your answer
![](https://koobas.hobune.stream/wayback/20220612140206im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to implement onTriggerEnter and onTriggerExit in Vuforia. 0 Answers
Slicing an int in js/unityscript? 1 Answer
How to load level after typing somthing? 1 Answer
unity javascript 0 Answers