I have 2 codes. IntersectionScript.js and IntersectionControl.js I attached the gameobjects with the IntersectionScript onto the open variables on the IntersectionControl. Now im wanting IntersectionControl to acsess the carWaiting variable. But it keeps giving me the “carWaiting’ is not a member of ‘UnityEngine.Component’.” What am i doing wrong?
// IntersectionScript
#pragma strict
var carWaiting : boolean = false;
private var stop : String = "Intersection";
private var go : String = "Go";
function Start ()
{
}
function Update ()
{
}
//IntersectionControl
#pragma strict
var colliderOne : GameObject;
var colliderTwo : GameObject;
var colliderThree : GameObject;
private var timer : int = 0;
function Start ()
{
}
function Update ()
{
if(colliderOne.GetComponent("IntersectionScript").carWaiting == false && timer == 0)
{
timer = 1;
}
if(colliderTwo.GetComponent("IntersectionScript").carWaiting == false && timer == 1)
{
timer = 2;
}
if(colliderThree.GetComponent("IntersectionScript").carWaiting == false && timer == 2)
{
timer = 0;
}
}