- Home /
"Insert a semicolon at the end." But there is a semicolon already!!
Hi. I (try to) use the ProgressBar script, but I get this error:
Here is the script:
void Update() {
float revealOffset = (float)(Time.timeSinceLevelLoad % 10) / 10.1F;
gameObject.renderer.material.SetFloat ("_Cutoff", revealOffset);
}
As you can see, there IS already a semicolon. What should I do? I tried to insert "var" at the second line, but it didn´t help.
EDIT: Ok, I changed it into C#, now I don´t get this error but I get a new parsing error at the same line...
You might try redoing it all in a fresh area. Force yourself to carefully read and check each step. If it works, compare with the version you have now, to see what was wrong (so you know not to do it again.)
If it doesn't work, you'll at least have a more precise question.
Unexpected errors or parsing errors often relate to the surrounding code. Strip the class down to the smallest that will give the error, then post the entire class.
Also try the following, don't think it will work, but:
float revealOffset = (float)((Time.timeSinceLevelLoad % 10) / 10.1F);
Answer by Landern · Jul 15, 2014 at 01:56 PM
The code you posted is in c# not javascript, use the correct script type and you will be good(maybe?).
// UnityScript(javascript) version if you need
function Update() {
var revealOffset : float = (Time.timeSinceLevelLoad % 10) / 10.1F;
gameObject.renderer.material.SetFloat ("_Cutoff", revealOffset);
}
okay, what did you do, did you create a c# script and change the update method? did you use the unityscript version and update your ProgressBar.js? What is the error?
I still get the error on line 2 (In the JS version):
The type "float" does not have a visible constructor that matches the argument list "(float)"
Your answer
Follow this Question
Related Questions
Script error about the semicolon. 1 Answer
UCE0001: ';' expected. There is one there? 1 Answer
Please insert semi colon... WHAT!?! 2 Answers
insert semicolon error 3 Answers