Question by
dtrexgaming · Jan 31, 2016 at 07:19 AM ·
javascripterror message
Help fixing a script (error BCE0038)
Need help with this
private var collided = false;
function OnCollisionEnter(){
if (!collided){
collided = true;
StartCoroutine(PlayAndDisappear());
}
}
// play and disappear after delay:
function PlayAndDisappear(){
GetComponent.<Animation>().Play("321go");
WaitForSeconds(4){
(GetComponent.<Animation>()["321go"]);
}
gameObject.SetActive(false); // deactivate object
}
I'm using this script to try to delete an animation (countdown from 3) after it hits Go so that it doesn't just take up the screen after hitting 3. Using the following script I am getting this error:
Assets/fuckingballs.js(15,4): BCE0038: 'UnityEngine.WaitForSeconds' is not a valid macro.
Could anyone here tell me how to fix the code? Thank you!
Comment
Answer by danny7 · Jan 31, 2016 at 08:04 AM
You don't use brackets with the WaitForSeconds command.
GetComponent.<Animation>().Play("321go");
yield WaitForSeconds (4);
GetComponent.<Animation>()["321go"];