- Home /
Error is: BCE0044: expecting '"', found 'r'.
I'm trying to make a shooting script but I got this error again. This time apparently on the line 9. Error is: BCE0044: expecting '"', found 'r'
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);
}
}
}
Comment
Best Answer
Answer by fendorio · Apr 04, 2014 at 09:28 AM
GameObject.Find("SpawnPoint').transform.position, Quaternion.identity);
In the .Find() method You open with a " and close with a '
Should be:
GameObject.Find("SpawnPoint").transform.position, Quaternion.identity);
Answer by wijesijp · Apr 04, 2014 at 09:29 AM
I am not sure whether it is formatting issue for this post or the problem is in your code but;
"SpawnPoint'
should end in double quotation marks
var bulletCreate = Instantiate(bulletPrefab, GameObject.Find("SpawnPoint").transform.position, Quaternion.identity);