- Home /
Gun Script Error (Fixed!!!)
Hi please help me i have a problem with my gun script
var Bullet: Transform;
function Update () {
if(Input.GetKey(¨Fire1¨)){
var ShootBullet = Instantiate(Bullet,GameObject.Find(¨Bullet_spawn¨).transform.position,Quaternion.identity);
bullet.rigidbody.AddForce(transform.Forward *20000);
}
}
Error Code: Assets/Gun_Shoot_Code.js(4.21): BCE0044: unexpected char: 0xA8
The error say that its at:
if(Input.GetKey(¨Fire1¨)){
I took the code from this video
If you find a other thing that may cause a error then please replay.
Answer by Dave-Carlile · Dec 31, 2012 at 09:23 PM
I'm not sure what character you're using for quotation marks, but they're not quotation marks.
You have:
if(Input.GetKey(¨Fire1¨))
It should be:
if(Input.GetKey("Fire1"))
If you're on a U.S. keyboard, it would generally be the key just to the left of the Enter key to get the correct quote mark.
Update: From this, it looks like you're using U+00A8 - the diaeresis character, or umlaut. You'll need to use a quotation mark instead.
Your answer
Follow this Question
Related Questions
Error line 22! Help. i dont know why? 1 Answer
bullets wont show up 1 Answer
Control amount of bullets 2 Answers
My bullet follows my plane... 1 Answer
How do shoot a bullet when the right button is clicked? 1 Answer