Folks, I need some help! I can’t get this stupid piece of code to work, even though I’m sure I had it working before…
All I’m trying to do is add my WayPoint object to my List of Waypoints… But for some reason, when I add this line of code “wayPoints.Add(temp);”, the whole thing fails. If I comment out the line, everything else works (except my waypoint clones are all sitting around without a list to connect them)!
if (mainCamPlane.Raycast(ray, out hitdist)) {
destinationPoint = ray.GetPoint(hitdist);
destinationPoint.y = 0;
WayPoint temp = (WayPoint) Instantiate(waypoint_orig, destinationPoint,Quaternion.identity);
wpAddToList = temp; //publicly exposed variable for testing...
wayPoints.Add(temp); //the offending line
}