- Home /
BCE0044 Error
Hello,
I'm getting an Error in Unity 3D. My first error was: "; Expected, please insert a semicolon". So thats what I Did in the correct spot. This was the error:
I Fixed that problem perfectly, but then. That created another error. This is a picture of it:
What am I Doing wrong. This is the script I'm trying to et working. Its a Mouse Look script:
public enum RotationAxis {MouseX = 0, MouseY = 1}
var RotationAxisRotationXY : RotationAxis = RotationAxis.mouseX || RotationAxis.mouseY;
//We are defining the variables needed for our X axis motion. This will include
//Sensitivity and the minimum and maximum for the x axis rotation.
var sensitivityX : float = 400f;
var maximumX : float = -360f;
var maximunX : float = 360f;
var RotationX : float = 0f;
var OriginalRotation : Quaternion;
// Now lets set the variables for the y axis so the player can look up and down
// using the mouse.
var RotationY : float = 0f;
var minimumY : float = -360;
var maximun : float = 360;
var sensitivityY : float = 400f;
var YQuaternion : Quaternion;
var XQuaternion : Quaternion;
function Update () {
if(RotationAxisRotationXY == RotationAxis.MouseX){
RotationX += Input.GetAxis("Mouse X") sensitivityX Time.deltaTime;
RotationX = ClampAngle (RotationX, minimumX, maximumX);
OriginalRotation = XQuaternion = Quaternion.AngleAxis (RotationX , Vector3.up);
transform.localRotation = OriginalRotation * XQuaternion;
}
if (RotationAxisRotationXY == RotationAxis.MouseY){
RotationY -= Input.GetAxis ("Mouse Y") sensitivityY Time.deltaTime;
RotationY = ClampAngle (RotationY, minimumY, maximumY);
OriginalRotation = YQuaternion = Quaternion.AngleAxis (RotationY, Vector3.right);
transform.localRotation = OriginalRotation * YQuaternion;
}
}
static function ClampAngle (Angle: float, min: float, max: float): float {
if(Angle < -360);{
Angle += 360;
} if(Angle > 360);{
Angle -= 360;{ }
return Mathf.Clamp (Angle, min,max); } }
In the console, double click on the error so it will highlight the exact place in the script where the error happens.
Answer by KiraSensei · Aug 08, 2012 at 10:01 AM
In your function ClampAngle, there is a weird "{}" thing in the if (Angle > 360). i think you want to delete the "{" after Angle -= 360; and delete one of the "}" at the end of the method.
EDIT : There is a ";" just after "if (Angle<360)" and "if (Angle>360)", delete them !
But why do you have these ? the return function is in a "if". Look at my answer again, I edited it.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Wierd error messages concerning audio play and pause? 1 Answer
Script to disable MouseLook? 2 Answers
Error CS1502 Help! 1 Answer
Script Error 4 Answers