Im just learning how to script and i’m receiving the same error every time, it says error Assets/jorge.js(7,1):: BCE0044: expecting }, found ". Here is my current script:
function Update()
{
if(Input.GetMouseButtonDown(0))
{
transform.up += 1;
}
Welcome to Unity Answers! Thanks for including exact error message you encountered. That usually makes it a lot easier for us to help you.
Careful organization is a programmer’s best friend.
If we organize your code a bit, the problem becomes more clear:
function Update() {
if(Input.GetMouseButtonDown(0)) {
transform.up += 1;
}
You’re missing a last } to end the Update() function.
As an aside, I’m fairly sure you mean something closer to this:
function Update() {
if(Input.GetMouseButtonDown(0)) {
transform.position += Vector3.up;
}
}
You can’t really add an int to a vector (each vector is represented by three numbers: x, y and z). In the revised code sample, I’m instead adding two vectors: current position + (0,1,0).