Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Invalid token '}' in class, struct, or interface member declaration

Discussion in 'Getting Started' started by Myst22, Mar 24, 2021.

  1. Myst22


    Mar 23, 2021
    hello everyone, i need help with this im beginner and im trying make a agar io game, now im making script "move"
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class move : MonoBehaviour {

    public float Speed;

    void update(int mDir) { }

    Vector3 Target = Camera.main.ScreenToWorldPoint(Input.mousePosition);

    Target.z transform;position.z

    transform;position Vector3;MoveTowards transform;position.Target.Speed * Time;deltaTime

    } <-- Invalid token '}' in class, struct, or interface member declaration
    pls help me
  2. Lurking-Ninja


    Jan 20, 2015
    ??? None of these is right.

    Use the code tag in the forum post editor toolbar...
  3. Schneider21


    Feb 6, 2014
    Welcome to the forums. As Lurking-Ninja pointed out, your code has quite a number of errors in it. What text editor are you using to write it? Most editors made for development provide syntax highlighting that would show you these errors and provide hints on how to fix it.

    Are you following a tutorial of some kind? It kinda looks like you just threw random words at the screen that you saw mentioned somewhere (the semicolon placement, in particular, feels almost entirely random). I think you should spend some time understanding the basics of C# before proceeding any further with your game. Maybe check out a series that covers intro concepts. I like Catlike Coding myself, but if you prefer videos, I'm sure there are plenty of those available, too.
    JoeStrout likes this.