Error In The Script
here is my code i got only 1 error as i fixed most of them i get a error ; expected insert a semicolon at the end. but i get in no way where i should add the last semicolon i managfed to fix 8 errors in the script and updated it to untiy 5 but now i only got 1 single error wich i seems to not solve
here is my code
int flyingSpeed = 100;
int; speedChange = 20;
int; rotationInt = 2;
Update();
{
if (Input.GetKeyDown (KeyCode.W));
{
flyingSpeed += speedChange;
}
if (Input.GetKeyDown (KeyCode.S));
{
flyingSpeed += -speedChange;
}
if (Input.GetKey (KeyCode.A));
{
transform.RotateAround (transform.position, transform.up, -rotateInt);
}
if (Input.GetKey (KeyCode.D));
{
transform.RotateAround (transform.position, transform.up, rotateInt);
}
}
there are 8 errors in that code. you need to post the complete error messages when asking for help...
all of your errors are because you've added semicolons in places they should not be.
try some c# tutorials to help you become familiar with the syntax.
no you're wrong im using a compleetly customeed unity 5 and these scripts are not wrong if you try to use this in unity 4 you will get 8 errors i know C pretty good + this is a java script i tried the error message is
":"Expected.insert semicolon at the end i got 8 errors of them and now i fixed it and only got 1 but no where to place it...
you need to learn how java works this scripts is not for C# was never either i am not the best at program$$anonymous$$g but sertain things i do know
no you're wrong im using a compleetly customeed unity 5 and these scripts are not wrong
LOL
Answer by Landern · Feb 10, 2016 at 02:47 PM
What gjf said, but you're using the line terminator to basically kill your if statements let alone your method called update which should have a return type(like IEnumerable) or void, you have terminators after the type when declaring variables. The code is also incomplete :(
int flyingSpeed = 100;
int speedChange = 20; // removed semicolon after the type declaration.
int rotationInt = 2; // removed semicolon after the type declaration.
void Update()
{
if (Input.GetKeyDown (KeyCode.W)) // removed semicolon after if statement
{
flyingSpeed += speedChange;
}
if (Input.GetKeyDown (KeyCode.S)) // removed semicolon after if statement
{
flyingSpeed += -speedChange;
}
if (Input.GetKey (KeyCode.A)) // removed semicolon after if statement
{
transform.RotateAround (transform.position, transform.up, -rotateInt);
}
if (Input.GetKey (KeyCode.D)) // removed semicolon after if statement
{
transform.RotateAround (transform.position, transform.up, rotateInt);
}
}
If this was actually meant to be unityscript/javascript(based off your comment above) then your script is completely wrong and should look more like:
var flyingSpeed:int = 100;
var speedChange:int = 20; // removed semicolon after the type declaration.
var rotationInt:int = 2; // removed semicolon after the type declaration.
function Update()
{
if (Input.GetKeyDown (KeyCode.W)) // removed semicolon after if statement
{
flyingSpeed += speedChange;
}
if (Input.GetKeyDown (KeyCode.S)) // removed semicolon after if statement
{
flyingSpeed += -speedChange;
}
if (Input.GetKey (KeyCode.A)) // removed semicolon after if statement
{
transform.RotateAround (transform.position, transform.up, -rotateInt);
}
if (Input.GetKey (KeyCode.D)) // removed semicolon after if statement
{
transform.RotateAround (transform.position, transform.up, rotateInt);
}
}
thanks understanded now im new to scripts but i do know the very well i midgh have gotten confused or something i dont know what i did
thanks to Ladern ad GFF for telling me now i get it :)
Here is the tutorial page. Tutorials are the top, scripting and other categories at the bottom :)
Its really worth having a look and working through them.
Good luck!
Your answer
![](https://koobas.hobune.stream/wayback/20220612063607im_/https://answers.unity.com/themes/thub/images/avi.jpg)