- Home /
Question by
zular games · Aug 27, 2012 at 11:57 PM ·
erroridentifierunknown
Help me It keeps giving me error Unknown identifier 'Fire'
var Projectile: Transform;
var firerate: float = 0.3;
private var nextFire: float = 0.5;
var Ammo: int = 30;
var empty: boolean = false;
function Update () {
if (Input.GetButton("Fire1")&&Time.time > nextFire)
{
if(Ammo > 0){
Fire();
}
else{
return;
}
}
if(Input.GetKeyUp("r")){
if(empty){
Reload();
}
}
if(Ammo <= 0){
audio.playOnAwake();
empty = true;
}
else{
empty = false;
}
}
fuction Fire(){
audio.PlayOneShot();
nextFire = Time.time + fireRate;
var shot = Instantiate(Projectile, transform.position, Quaternion.identity);
shot.rigidbody.AddForce (transform.forward * 3000);
Ammo--;
}
fuction OnGUI(){
GUI.Box (Rect(Screen.width - 100, 20, 100, 80), "");
GUI.Label (Rect (Screen.width - 100, 35, 90, 20), "Ammo:" + Ammo);
GUI.Label (Rect (Screen.width - 100, 20, 90, 20), "Health" + PlayerHealth.currentHealth);
if(empty){
GUI.contentColor = Color.red;
GUI.Label (Rect (Screen.width - 100, 50, 90, 20), "RELOAD");
}
}
@script ExecuteInEditMode()
Comment
Answer by DaveA · Aug 28, 2012 at 12:00 AM
fuction Fire(){
and
fuction OnGUI(){
should be
function Fire(){
function OnGUI(){
Your answer
Follow this Question
Related Questions
BCE0005: Unknown identifier: 'transform' 2 Answers
Error BCE0005: Unknown identifier: 'GetAxis'. 0 Answers
Error BCE0005: Unknown identifier: 'GetAxis'. 0 Answers
Unknown Identifier maxSlope 1 Answer