class WaypointCollection extends System.Object
{
var wp1 : Transform;
var wp2 : Transform;
var wp3 : Transform;
var wp4 : Transform;
var wp5 : Transform;
var wp6 : Transform;
var wp7 : Transform;
var wp8 : Transform;
var wp9 : Transform;
var wp10 : Transform;
var wp11 : Transform;
var wp12 : Transform;
var wp13 : Transform;
var wp14 : Transform;
var wp15 : Transform;
var wp16 : Transform;
var wp17 : Transform;
var wp18 : Transform;
var wp19 : Transform;
var wp20 : Transform;
}
and I call it with this line:
var waypoints : WaypointCollection = new WaypointCollection();
this works fine, but I think there is a shorter way instead of setting each wp as a single var.
Is there any way to give a parameter with the number off waypoints to set? Something like the size attribute in the Inputmanager.
If someone have a better solution please tell me, otherwise I will use this one I have now.
If your waypoints are static, consider using actual dummy gameObjects to mark your waypoints. In this fashion the position of the dummy object in the scene is the position of the waypoint. You can then use an array of gameObjects instead of a list of positions, and drag them from your scene into the array in the inspector.
Not only easier to manage, but added utility. The waypoints can then have attributes and scripts attached. A boolean to signify active/inactive, a variable to point to the next waypoint, script to move itself about, etc.
So the final implementation depends on how your scene and waypoints are configured, but with some forethought there are some ways to further leverage the exposed inspector array.
thx for the explanation, Iam already have some Good Ideas for an AI, but I didnt know howto create this size element in the Inspector, now I know and everything is fine Thanks again.