- Home /
UCE0001 semicolon expected
Since I'm relatively new to coding, this may seem like a trivial issue to you all. It says that on line 15 a semicolon is expected. I already have a semicolon so I think it's an issue with the rest of the code. Can someone help, please?
#pragma strict
var rotationSpeed = 75;
var jumpHeight = 10.5;
function Update ()
//first lines!
{var rotation : float = Input.GetAxis ("Horizontal")*rotationSpeed;
rotation *= Time.deltaTime;
GetComponent.<Rigidbody>().AddRelativeTorque (Vector3.forward*rotation);
if (Input.GetKeyDown(KeyCode.W)) IsFalling = false;
{
GetComponent.<Rigidbody>()velocity.y = jumpHeight;
IsFalling = true;
}
}
function OnCollisionEnter()
{
{IsFalling=false;
}
}
Please edit your question and format your code properly using the "101010" button.
I dunno if it is just me, but none of the buttons of graphics in the editor anymore. maybe a firefox bug.
Please format your code correctly. Currently, it's impossible to tell what line 15 is, and your use of {curly brackets} is also a bit bizarre.
I have the same Issue of the buttons not showing. if you slowly take your mouse along where the buttons should be, they will give info text of what they are. Code snippet should be between the first 2 lines, say 4-5 buttons in
Right, the buttons image is suddenly missing on the unity server. It's like that for several days now. I was about to write a bug report about that. It's basically the "wmd buttons" image that is missing on UA. The link i provided is from stackoverflow.
UnityAnswer is trying to load this image from here but as you can see, the image is somehow missing.
Answer by Bunny83 · Jul 18, 2017 at 11:17 PM
You're missing a dot after you get the Rigidbody component.
GetComponent.<Rigidbody>()velocity.y = jumpHeight;
this line should be:
GetComponent.<Rigidbody>().velocity.y = jumpHeight;
Note the dot between "()" and "velocity".
You really shoud format your code in a consistent way. i.e.:
#pragma strict
var rotationSpeed = 75;
var jumpHeight = 10.5;
function Update ()
{
var rotation : float = Input.GetAxis ("Horizontal")*rotationSpeed;
rotation *= Time.deltaTime;
GetComponent.<Rigidbody>().AddRelativeTorque (Vector3.forward*rotation);
if (Input.GetKeyDown(KeyCode.W))
IsFalling = false;
GetComponent.<Rigidbody>().velocity.y = jumpHeight;
IsFalling = true;
}
function OnCollisionEnter()
{
IsFalling=false;
}
This is what your code looks like when formatted properly. However the whole GetKeyDown thing seems to be non-sense. It's not clear what you wanted to do here.
Thank you so much. Also the get key down thing is for pressing the ''W'' resulting in a jump. Problem Solved!
Answer by WideEyeNow · Jul 18, 2017 at 10:41 PM
I'm not familiar with javaScript, but does that period belong after GetComponent? And shouldn't still, jumpHeight be declared first? jumpHeight = GetComponent??
Your answer