- Home /
BCE0044: expecting '"', found '\r'.
So I'm trying to make weapon shoot script and got this error. The error appears to be on the line 7. Error is: BCE0044: expecting '"', found '\r'.
I wrote the script twice and tried for about an hour but I can't find out what's wrong. Thanks for any help. (:
public var bulletPrefab:Transform;
public var bulletSpeed : float = 6000;
function Update() {
if(Input.GetMouseButtonDown(0)){
if(!bulletPrefab || !bulletSpeed){
Debug.Log("[Shoot] 'bulletPrefab' or 'bulletSpeed' is undefined');
}else{
var bulletCreate = Instantiate(bulletPrefab, GameObject.Find("SpawnPoint').transform.position, Quaternion.identity);
bulletCreate.rigidbody.AddForce(transform.forward * bulletSpeed);
}
}
}
Answer by perchik · Apr 03, 2014 at 07:32 PM
Your error says it, it's expecting a " but instead found a \r
. (`\r` is a newline character) on line 7.
If you look close, you'll notice you start a string, but never close it. In fact, when you posted your code on here, the autoformatting highlights that well ( see how the rest of your code is green after that point)
Debug.Log("[Shoot] 'bulletPrefab' or 'bulletSpeed' is undefined');
needs a quote at the end:
Debug.Log("[Shoot] 'bulletPrefab' or 'bulletSpeed' is undefined' ");
Thanks for the help. It solved the error. But after that another error came. It shows the same BCE0044: expecting '"', found 'r'. But this time on the line 9. I can't find out how to solve it. I tried putting " there and such.