- Home /
complier Error unexpected char' '.
im typing a code for a sphere to move here is the script:
var speed: player1 = 3.0 ;
var rotateSpeed: player1 = 3.0;
function Update ()
{
var controller : CharacterController= GetComponent(CharacterController);
// Rotate around y - axis
transform.Rotate(0. Input.GetAxis ("horizontal") * rotateSpeed. 0);
// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("vertical");
controller.SimpleMove(forward * curSpeed);
}
@script RequireComponent(CharacterController)
var speed: player1 = 3.0 ;
var rotateSpeed: player1 = 3.0;
function Update ()
{
var controller : CharacterController= GetComponent(CharacterController);
// Rotate around y - axis
transform.Rotate(0. Input.GetAxis ("horizontal") * rotateSpeed. 0);
// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("vertical");
controller.SimpleMove(forward * curSpeed);
}
@script RequireComponent(CharacterController)
and it gives me this error:
Assets/move the ball.js(10,28): BCE0044: unexpected char: ' '.
plz tell me what im doing wrong the error is on line 10
Answer by ByteSheep · Dec 16, 2011 at 09:49 PM
The code is being displayed rather funnily, but I'm guessing each of the numbers declares a line break? In that case the line with the error is:
transform.Rotate(0. Input.GetAxis ("horizontal") * rotateSpeed. 0);
The "0." after the first bracket and the ". 0" before the end bracket are going to give you errors.. Try this:
transform.Rotate(Input.GetAxis ("horizontal") * rotateSpeed);
Hope this helps you get past the error and get on with your project..
I agree that the transform.Rotate line is the problem. But I think that the problem is because ins$$anonymous$$d of writing
transform.Rotate(0, Input.GetAxis ("horizontal") * rotateSpeed, 0);
he wrote
transform.Rotate(0. Input.GetAxis ("horizontal") * rotateSpeed. 0);
I think you just need to change the "."'s to commas and it would work.
Your answer
![](https://koobas.hobune.stream/wayback/20220613062138im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Shader error in ... : Syntax error at line 30 1 Answer
Android SDK Root Folder 3 Answers
Internal Compiler Error, caused by System.Windows.Forms.dll 1 Answer
Internal Compiler Error 1 Answer
error issues : KeyNotFoundException 1 Answer