Search Unity

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

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

  1. Myst22

    Myst22

    Joined:
    Mar 23, 2021
    Posts:
    1
    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. ??? None of these is right.

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

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    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.