 Travis
|
Actually the code in the example scene is correct. If we’re talking about the call SimpleMove in AIFollow. That was already in the Update function, not FixedUpdate. Did you just type it out wrong in the tutorial?
|
 Aron Granberg
|
Yup, only in the tutorial.
|
 David Tredeau
|
I added this code to the AIfollow script in order to have it randomly choose a final destination.
public Transform[] target = new Transform[10];
public int waypoint;
After adding this code I got these errors.
`UnityEngine.Transform[]‘ does not contain a definition for `position’ and no extension method `position’ of type `UnityEngine.Transform[]‘ could be found (are you missing a using directive or an assembly reference?)
The best overloaded method match for `Seeker.StartPath(UnityEngine.Vector3, UnityEngine.Vector3, OnPathDelegate)’ has some invalid arguments
`#2′ cannot convert `object’ expression to type `UnityEngine.Vector3′
|
 Aron Granberg
|
Transform[] is an array not a single Transform object. An array does not contain a “position” variable.
You will have to change so it picks a target transform, i.e calculate a randomized index so you can access it like target[4].position, which will give you the 5th target transform.
|