Hi, I’m currently working inside the AIpath2 script and i would like to chagne the target when a certain condition is met.
first i find the gameobject that is going ot be the next target, then i take it’s transform and i pass that to the target variable in the script, but it does not change anything… how can i do this ?
Hi
Doing something like this would work.s wi
`
AIPath ai;
void Start () {
ai = GetComponent();
}
void Update () {
if (Time.time > 4) {
ai.target = GameObject.Find (“MyNewTarget”).transform;
}
}`
This will change the target of the attached AIPath object to the MyNewTarget GameObject (make sure it exists) after 4 seconds.