UCE0001: ';' expected. Insert a semicolon at the end
Hi. I'm having an issue with my code. I entered the exact code it said to in the tutorial, and then I even went so far as to copy-paste the exact code the guy had written down in the website. But it still gave me the same error.
The code in question:
function Update () {
if(Input.GetButtonDown("Fire1")) {
var gunsound : AudioSource = GetComponent.<AudioSource>{};
gunsound.Play();
GetComponent.<Animation>().Play("GunShot");
}
}
Thanks.
is this all there is? which line comes your error from?
I don't know which line. The error in full is: "Assets/Scripts/Gunfire.js(3,72): UCE0001 ';' expected. Insert a semicolon at the end. I don't actually know what the problem is or how to fix it, thus why I asked the question.
Answer by hexagonius · Feb 22, 2016 at 08:56 AM
replace the curly braces on the GetComponent with normal ones
Thank you my good sir, you're a legend. I can't believe I made such a rookie mistake. Sometimes you just overlook things.
Your answer
Follow this Question
Related Questions
I am getting an error that doesn't make sense! 1 Answer
Pickup script not working, pls help 0 Answers
How do I add a simple jump function to this script? 2 Answers
what is wrong here? 0 Answers
Double jumping not working - can't find the culprit 1 Answer