- Home /
Can't add script - need to fix all compile errors
I'm trying to attach MoveScript to one of the game objects, but it gave me a compiling error. I restarted Unity to see if it fixes it, and it says i need to compile the errors in the scripts first. However, I cannot seem to fix the error. "Assets/Scripts/MoveScript.cs(5,24): error CS8025: Parsing error" I'm currently following a tutorial and have the exact same script. I've triple checked the brackets. (Previously, I had an error for mismatching the file names, and fixed it by adding .cs, but now the error seems to occur in the same spot (line 2). I've tried removing .cs, but the error remains.) Any help is appreciated.
using UnityEngine;
public class MoveScript.cs : MonoBehaviour
{
public Vector2 speed = new Vector2(10,10);
public Vector2 direction = new Vector2(-1, 0);
private Vector2 movement;
void Update ()
{
movement = new Vector2 (
speed.x * direction.x,
speed.y * direction.y);
}
void FixedUpdate ()
{
rigidbody2D.velocity = movement;
}
}
Answer by Jeff-Kesselman · May 30, 2014 at 11:47 PM
Class names do not have .cs at the end, to begin with.
If you format your code better we may see other errors..