Search Unity

"The project you are opening contains compilation errors" When creating new project

Discussion in 'Getting Started' started by OrangeWind, Nov 30, 2022.

  1. OrangeWind

    OrangeWind

    Joined:
    Nov 29, 2022
    Posts:
    1
    The problem I'm facing is: Evertime I try to create a totally new project or open a official example project should contain no error, the Unity will say the there are compilation errors in my project, just like the screenshot below:
    upload_2022-11-30_20-47-42.png
    And this situation will happen in any different version of Unity, I have tried these versions: 2021.3.14, 2020.3.42, 2020.3.25, 2019.4.40.
    And the error messages in console of each version are different, in 2021.3.14:
    upload_2022-11-30_20-47-42.png
    (This kind of disorderly code should be Chinese I think, the reason maybe the Chinese encoded question in Unity.. But I don't know why, because the Unity Hub and Unity I installed are all from UK website)
    In 2020.3.42 and 2020.3.25:
    upload_2022-11-30_20-47-42.png
    And in 2019.4.40 the error message is just like the error message in 2020 version, just the "Compiler version 3.5.0-dev" changes to "Compiler version 2.9.1" (I don't have the screenshot cause I have deleted the 2019 version).
    >>Here I'll explain the process I download and install Unity:
    I just have an anaconda preinstalled in my computer(which is related to the Unity), and for the first time, I also have the Visual Studio2019 installed in my computer(But I try to uninstall VS2019 before install Unity later, it doesn't work). And I download and install the Unity Hub from official website, then install the Unity 2021.3.14 in Unity Hub. That's all the process, I didn't change anything else in the system about Unity. (There is actually one another thing I have done, but I don't think it's a reason. I download the ml-agents plugin in github, and created a new anaconda environment for it, with just python3.6 and pytorch and ml-agents installed. Then I try to add ml-agents in Unity's packages even it's in compilation error state.)
    >>Here is some info about my computer:
    UK computer with Windows11, with anaconda, some jdk and SQL installed.
    >>And here is the list of things I have tried, all from internet:
    1. Change the "Api Compatibility Level*" in Edit->Project Settings->Player->Other Settings->Configuration
    2. Download different version of Unity(as mentioned above)
    3. Delete some packages that may cause this problem
    4. Reimport all the assets of the project
    5. Delete the Unity_lic.ulf file in the directory: C:\ProgramData\Unity and let Unity reload it
    6. Somebody says this may be caused by some antivirus program, so I removed all the antivirus program on my computer (except virus defense program of win11, cause I don't know how to close it and I think it is better to not close it), and completely remove all the Unity files on my computer (probably, I don't know), the remove steps are:
    1) Delete the Unity Editor and Unity Hub files directly
    2) Delete temporary file related to Unity:
    C:\ProgramData\Unity
    C:\Users\Username\AppData\Local\Unity
    C:\Users\Username\AppData\Local\unityhub-updater
    C:\Users\Username\AppData\LocalLow\Unity
    C:\Users\Username\AppData\Roaming\Unity
    C:\Users\Username\AppData\Roaming\UnityHub
    3) Remove all the Unity related folders in windows registry(to ensure the thing I'm saying, to open this, press win+R, then type"regedit"):
    HKEY_CURRENT_USER\Software\Unity
    HKEY_CURRENT_USER\Software\UnityTechnologie
    And reinstall the whole Unity in a totally different directory, to avoid the Unity influenced by the folder path name(like too long, or contains Chinese character), I create a new folder F:\Unity, and create four folder"Download", "Editor", "Hub", "Project" to hold download tem files, Unity Editor, Unity Hub and project file respectively. Then I download and install Unity Hub, then install Unity Editor in Unity Hub, create new project, and everything don't change...
    P.S. I also download a Unity use the same process as me on the computer of my roommate. His computer is also win11, with anaconda and Visual Studio preinstalled. And everything went right, it just took me several minutes to successfully create a new project.
     
  2. vivek_sachan

    vivek_sachan

    Joined:
    May 26, 2017
    Posts:
    3
    i am having the same issue , there seems to no solution anywhere i m however using unity on ubuntu
     
  3. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    What version of Unity are you using? I successfully completed 2 tutorial projects on the 2021 version last week, on Ubuntu Linux.
     
  4. RK1PF

    RK1PF

    Joined:
    Apr 3, 2023
    Posts:
    1
    I have the same issue on windows, I have tried to uninstall all the packages and the compiler errors disapear but errors are back as soon as I add any package, also the compiler errors are back when I create a simple C# script.
    Maybe it is related to Visual Studio ?
    I'm using the latest Unity Hub, Unity Editor and Visual Studio
    upload_2023-4-8_11-13-32.png
     
  5. leonnye

    leonnye

    Joined:
    Jun 16, 2023
    Posts:
    1
    Hi,
    Sharing my experience here.
    First, looks like your OS doesn't support UTF-8 encoding, that's where the unreadable characters in your console came from. To fix it, go to Windows startup => Settings => Time and language => language => Administrative language settings (on the far right of the screen), then you will open the "Region" panel. Click "Change system locale",
    Then check the box "Use Unicode UTF-8 for worldwide language support".
    BTW, I am using Win 10 and Chinese OS.

    upload_2023-6-16_23-43-24.png
    upload_2023-6-16_23-44-33.png

    Now open Unity project, I think you will see the correct error message. My message is " The system cannot find the path specified".
    If that's the case, then everything else is easy. You can check the link (https://superuser.com/questions/727...ine-the-system-cannot-find-the-path-specified) or follow the steps here:
    1. Open the Registry Editor (press Win+R, type regedit and hit Enter) .
    2. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun and clear the values.
    3. Also check HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun.
    In my case is because I changed the system environment before when I use Anaconda for Python. So my autorun value is the path for Anaconda.
    upload_2023-6-17_0-0-39.png

    Clear the value and close the registry (Remember to CLOSE it!). Now open your Unity project again. I think the error message will gone and you can enjoy Unity now.

    Gook luck.
     
  6. shevkar

    shevkar

    Joined:
    Oct 16, 2023
    Posts:
    3