Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Error CS1002 Expected (14,28)

Discussion in 'Scripting' started by lelipop71177, Aug 21, 2020.

  1. lelipop71177

    lelipop71177

    Joined:
    Aug 21, 2020
    Posts:
    1
    I wrote a code for 2d character movement and I got this error that says I needed a semicolon at line 14, but I can't find where :/

    Code:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class NewBehaviourScript : MonoBehaviour
    4. {
    5.     public float MovementSpeed = 1;
    6.     private void Start()
    7.     {
    8.      
    9.     }
    10.  
    11.      private void Update()
    12.     {
    13.         var movement = Input.GetAxis("Horizontal");
    14.         transform position +- new Vector3(movement, 0, 0) * Time.deltaTime * MovementSpeed;
    15.     }
    16. }
    17.  
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,196
    Line 14, you have transform positon +-

    So you appear to be missing a period and you're trying to add and subtract.
     
    Yoreki likes this.