Parsing error: Can't figure out what my script problem is.

Hi,
I wrote a script that should move my ship according the AddForce. But it says :

//Assets/ControllerMov.cs(23,9): error CS8025: Parsing error

Here is my code:

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {

    public float speed;

    private Rigidbody2D rb;

    void Start () {

        rb = GetComponent<Rigidbody2D>();
    }
    void FixedUpdate () {

        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");

        Vector2 movement = new Vector2 (moveHorizontal, moveVertical);

        rb.AddForce (movement * speed);

    }

I can’t seem to figure out where parsing problem is.

is different than:

The file name (ControllerMov.cs) should always match the class name (at least one class in the file) which in this case is not ControllerMov but “Movement”.

Alternatively, your looking at the wrong script, and the error is happening in a different script.

1 Like

Oh it’s because i tansferred my script to another one but the names were different. I also was missing a } at the end of the script. Thank you.

1 Like

No problem, good luck!

Also, since it seems like maybe you’re not aware, the numbers in the error (23, 9) are the line and column of where the error is. If you double-click the error, it should put the cursor at the point where the error is in the script.

2 Likes