Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Type or namespace definition, or end-of-file expected

Discussion in 'Scripting' started by NOT_A_ROBOT1101, Jan 28, 2021.

  1. NOT_A_ROBOT1101

    NOT_A_ROBOT1101

    Joined:
    Jun 18, 2020
    Posts:
    39
    I've been coding C# for a year now and I have never seen an error like this without knowing a solution.
    upload_2021-1-28_12-12-46.png
    If I remove the last 2 closing brackets, the error disappears in VSCode, but appears in Unity.
    If I don't it only appears in VSCode.
    How do I fix this?
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,833
    If you can compile and run in Unity, but VS Code gives an error, that suggests the problem is somehow with VS Code rather than with the source code you've written. Have you tried restarting or reinstalling?
     
  3. NOT_A_ROBOT1101

    NOT_A_ROBOT1101

    Joined:
    Jun 18, 2020
    Posts:
    39
    Thanks, closing the file then opening it again worked. This happens a lot though, so I hope Microsoft fixes it soon.