Hi, Im trying to do a simple code for make my charather move, but it seems there is a error
" PlayerMovement.cs(19,27): error CS1002: ; expected "
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed;
public Rigidbody2D rb;
private Vector3 velocity = Vector3.zero;
void FixedUpdate()
{
float horizontalMovement = Input.GetAxis(“Horizontal”) * moveSpeed * Time.deltaTime;
MovePlayer(horizontalMovement);
}
void MovePlayer(float _horizontalMovement)
{
Vector3 targetVelocity = new Vector2(_horizontalMovement,rb.velocity.y)
rb.velocity = Vector3.SmoothDamp(rb.velocity, targetVelocity, ref velocity, .05f);
}
}
May I have help please ? thanks in advence
Vector3 targetVelocity = new Vector2(_horizontalMovement,rb.velocity.y);
Did you read error message?
1 Like
The error tells you the exact problem already. The compiler is expecting a “;” semicolon, meaning you are missing a semicolon.
1 Like
Actualy, If I put a " ; " where the problems seems, it make even more problems 
Note that when the compiler hits an error, it stops compiling. If you have multiple compile errors in your code, how you often see it play out is you fix one, then the compile gets further and a new error is reported. You fix that new one, the compile gets even further, until another error appears. You keep doing that over and over, until all errors are resolved with a completed compile.
To someone who doesn’t understand, it appears as if fixing one error is causing new errors, but what is really happening is all the errors were already there to start with. The compiler just couldn’t get far enough to report on all the other errors.