BCE0044: Expecting : Found = Error!

Hey,

I’m getting this BCE0044 Error on Unity 3D, It says: Expecting : Found =
I’m trying to get my Movement script going. This is the script with the error in it:

var walkAcceleration : float = 5;
var cameraObject : GameObject;
var maxWalkSpeed : float = 20;
@HideInInspector
var horizontalMovement : Vector2;

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;

transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent  (FPSMouseLook).currentYRotation, 0);


rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration, 0, Input.GetAxis("Vertical") * walkAcceleration);

}

The error is happening on Line: 15 Column: 25.
If you know how to fix this problem, please leave a comment below! Thanks!

if (horizontalMovement.magnitude > maxWalkSpeed);
}
horizontalMovement.Normalize;
horizontalMovement *= maxWalkSpeed;
{

Your brackets are backwards…

Quite a mess actually :slight_smile:

  1. Remove the semicolon after your if statement (ln 10)

  2. You inversed the curly braces defining the body of your if statement (ln 11,14)

  3. Normalize is function - so missing () here (ln 12)

    var walkAcceleration : float = 5;
    var cameraObject : GameObject;
    var maxWalkSpeed : float = 20;
    @HideInInspector
    var horizontalMovement : Vector2;

    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;

    transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent (FPSMouseLook).currentYRotation, 0);
    rigidbody.AddRelativeForce(Input.GetAxis(“Horizontal”) * walkAcceleration, 0, Input.GetAxis(“Vertical”) * walkAcceleration);
    }