- Home /
Question by
thesteveno9 · Dec 05, 2013 at 09:43 PM ·
gungunfire
I have been working on an fps for 15 hours now and have ran into this error please can you help Assets/Scrips/Gun script.js(7,1): BCE0044: unexpected char: 0xFEFF.
public var bulletPrefab : Transform;
public var bulletSpeed : float = 6000;
var ammo : int = 30;
var gunShot : AudioClip;Shot;
var reload : AudioClip;Reload;
var emptyClip : boolean = false;
}
function Update )) {
if(Input.GetButtonDown("Fire1")) {
if(ammo > 0) {
Shoot();
}
else{
return;
}
}
if(Input.GetKeyDown(KeyCode.R)) {
if(emptyClip) {
Reload();
}
}
if(ammo >= 0) {
emptyClip = true;
}
else {
emptyClip = false;
}
}
function Shoot(){
var bullet = Instantiate(bulletPrefab, transform.Find("BulletSpawn").position, transform.Find("BulletSpawn").rotation);
bullet.rigidbody.AddForce(transform.forward * bulletSpeed);
audio.PlayOneShot(Shot);
ammo--;
}
function Reload() {
audio.PlayOneShot(Reload);
ammo = 30;
}
function OnGUI() {
GUI.Label(Rect ( 0,0, 75, 25), "Ammo " + ammo);
}
Comment
Answer by GameVortex · Dec 06, 2013 at 09:39 AM
On line #7 you have an extra bracket "}" that does not have a start, remove it. On line #8 your Update() function has a reversed "(", flip it around.
Plus this doesn't make mush sense either:
var gunShot : AudioClip;Shot;
var reload : AudioClip;Reload;
Good catch, did not see that. Yeah, removing "Shot;" and "Reload;" should work.