- Home /
Expecting ':' Found '=' Error
I'm getting an error saying "Expecting ':' Found '='"
This is my function I'm getting the error in:
function Update ()
{
horizontalMovement = Vector2(rigidbody.velocity.x, rigidbody.velocity.z);
if (horizontalMovement.magnitude > maxWalkSpeed)
{
horizontalMovement.Normalize ();
horizontalMovement *= maxWalkSpeed;
}
{
rigidbody.velocity.x = horizontalMovement.x;
rigidbody.velocity.z = horizontalMovement.y;
}
if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0)
{
rigidbody.velocity.x = Mathf.SmoothDamp(rigidbody.velocity.x, 0, walkDeaccelerationVolx, walkDeacceleration);
rigidbody.velocity.z = Mathf.SmoothDamp(rigidbody.velocity.z, 0, walkDeaccelerationVolz, walkDeacceleration);
}
transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(FPSMouseLook).currentYRotation, 0);
rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration, 0, Input.GetAxis("Vertical") * walkAcceleration);
if (Input.GetButtonDown("Jump") && grounded)
rigidbody.AddForce(0, jumpVelocity, 0);
}
If you know how to fix this error, Please leave a comment below! Thanks in advance! The Error is on line: 26 Column: 28 -
rigidbody.velocity.x = horizontalMovement.x;
And
rigidbody.velocity.z = horizontalMovement.y;
Comment
It would help if you pointed out which line the error occurred on.
rigidbody.velocity.x = horizontal$$anonymous$$ovement.x;
And
rigidbody.velocity.z = horizontal$$anonymous$$ovement.y;
Answer by Eric5h5 · Aug 11, 2012 at 07:09 AM
You have braces around these lines:
{
rigidbody.velocity.x = horizontalMovement.x;
rigidbody.velocity.z = horizontalMovement.y;
}
The braces should be removed.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
BCE0044: Expecting : Found = Error! 2 Answers
Error UCE0001 ";"Expected 2 Answers
BCE0044 Error 1 Answer