basic code from tutorial not working

im trying to the first tutorial example with the code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player_controller : MonoBehaviour {

private Rigidbody rb;

void Start ()
{
rb = GetComponent();
}

void FixedUpdate()
{
float moveHorizontal = Input.GetAxis(“Horizontal”);
float moveVertical = Input.GetAxis(“Vertical”);

Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical)

rb.AddForce (movement);
}
}
being what is taught but Unity give:
Assets/Scripts/Player_controller.cs(21,8): error CS1525: Unexpected symbol `rb’
here:
→ rb.AddForce (movement);

whats wrong, I did it just like its written but it doesn’t work.

You forgot a semicolon on the line before rb.AddForce(movement);

Since the compiler expects a semicolon (or something that connects with the line before) it just tells you the symbols on the next line was unexpected.

It can be good to remember always to check the line before where error shows up.

Thanks for that. of course no matter what language i write in its always that one character messup that screws everything and cant be found.

1 Like

Visual Studio or whatever editor you’re using should be catching these and telling you the problem before you even save the file. You should have seen an error similar to Expected ‘;’ pointing to the line it was missing. Check for these errors in your editor.

If you look at the bottom of his post, he did include the error.

By the way @rycornx you should put your code between code tags in the forum next time.