Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Error ; expected Insert a semicolon at the end even though i put one

$
0
0
so here is my problem after some coding i came up with a simple error "UCE0001: ';' expected. Insert a semicolon at the end." here is my script and the error is on 46,17. I clearly put a semicolon there but i still get the error. Please help!!!! (Javascript) error on line 46,17 var Bullet : Rigidbody; var Spawn : Transform; var Bulletspeed : float = 1000; var ReloadTime : float = 2; var AmmoInMag : float = 30; static var AmmoLeft : float; private var CanFire = true; function Start () { AmmoLeft = AmmoInMag; } function Update () { if(Input.GetButtonDown("Fire1")){ if(AmmoLeft > 0){ BroadcastMessage("FireAnim"); Fire(); } } if(AmmoLeft == 0) { Reload(); } if(AmmoLeft > 0){ AmmoLeft = 0; } } function Fire(){ if(CanFire == true){ var bullet1 : Rigidbody = Instantiate(Bullet,Spawn.position,Spawn.rotation); bullet1.AddForce(bullet1.transform.forward *Bulletspeed); AmmoLeft -= 1; audio.Play(); } } function Reload(){ CanFire = false; Brodcast Message("ReloadAnim"); yield WaitForSeconds(ReloadTime); CanFire = true; }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>