Error message: gameObject is not a member of 'UnityEngine.Collider
Im going through a tutorial teaching me how to do waypoint AI pathing.
Heres all my code, Ive heard there can be issues will calling a GameObject, did I miss type something?
var neighbors:Collider[];
function Update () {
}
//the function to receive data
var countdown: int = 3;
function setData(incomingData)
{
countdown = incomingData;
countdown --;
Debug.Log("the waypoint " + this.name + " sent the countdown of " + countdown);
sendData();
}
function sendData ()
{
if (countdown > 0)
{
for (var neighbor in neighbors)
{
neighbors.gameObject.GetComponent(Waypoint).setData(countdown);
}
}
}
//the function that sends data to the neighbors
var mask : LayerMask = 1 << 8;
var sphereDistance: int = 10;
private var breakWhile: int = 1;
function Awake () {
while (neighbors.Length < 3 && breakWhile < 10){
neighbors = Physics.OverlapSphere(transform.position,sphereDistance,mask);
sphereDistance += 10;
breakWhile ++;
}
}