- Home /
Help with BCE0019: 'enabled' is not a member of 'UnityEngine.Component'
Hi guys, I'm a total newbie to coding and would appreciate some help please. I've been following a tutorial for a countdown which will disable car movement until the count finishes.
Here is the full script for the countdown.
var guiCountDown : GUIText;
var countMax : int;
private var countDown : int;
function Start(){
guiCountDown.enabled=true;
GameStart();
}
function GameStart(){
var car = gameObject.Find("PlayerCar 1");
var drivingScript = car.GetComponent("PlayerCar");
drivingScript.enabled=false;
for (countDown = countMax; countDown>-1;countDown--){
if(countDown == 0) {
guiCountDown.text = "GO!";
}
else
guiCountDown.text = countDown.ToString();
yield WaitForSeconds(1);
}
guiCountDown.enabled=false;
drivingScript.enabled=true;
}
I get the error: BCE0019: 'enabled' is not a member of 'UnityEngine.Component'. (14,23)/ (29,23)
Any ideas where I have gone wrong?
Comment
Best Answer
Answer by zippitdan · Jan 03, 2014 at 06:52 PM
It's fixed now. I just removed the quotation marks from PlayerCar on line 14. it now reads:
var drivingScript = car.GetComponent(PlayerCar);
Your answer
Follow this Question
Related Questions
Countdown To Start Game 2 Answers
AI Car Problem 1 Answer
NFS Style Motion Blur 1 Answer