- Home /
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!
Answer by Tommynator · Aug 09, 2012 at 08:19 AM
Quite a mess actually :)
Remove the semicolon after your if statement (ln 10)
You inversed the curly braces defining the body of your if statement (ln 11,14)
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); }
O$$anonymous$$G Dude, Thankyou sooooooo much! I'm just starting out my game development carreer, So I'm new to codeing. Thanks anyway!
Answer by Mizuho · Aug 09, 2012 at 08:16 AM
if (horizontalMovement.magnitude > maxWalkSpeed);
}
horizontalMovement.Normalize;
horizontalMovement *= maxWalkSpeed;
{
Your brackets are backwards...
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Expecting ':' Found '=' Error 1 Answer
Vehicle/car/ Movement 0 Answers
Spawn Script Issue 0 Answers
create variable trouble 1 Answer