function OnTriggerEnter (racer : Collider) {
if (racer.Controller.laps < 5) {
laps++;
}
else if (racer.Controller.laps >=5) {
winGame();
}
}
function winGame () {
//do winning stuff here.
Application.LoadLevel("2"); //another level for instance.
}
Assets/startfinishline.js(4,21): BCE0019: ‘Controller’ is not a member of ‘UnityEngine.Collider’.
Assets/startfinishline.js(4,68): BCE0019: ‘Controller’ is not a member of ‘UnityEngine.Collider’.
Assuming Controller is a component attached to the racer’s game object you would have to have a GetComponent(“Controller”), or something similar, in there somewhere to get a reference to it before you could use it’s members.
The solution to the errors you’re getting is that the variable ‘racer’ is a Collider and there is no property called ‘Controller’ associated with colliders.
if (racer.Controller.laps < 5) {
This needs to be changed, but without more details, you’re not going to get much useful information.