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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Other I get a popup message that asks me to enter safe mode if I open my project

Discussion in 'Editor & General Support' started by Asough, Nov 26, 2022.

  1. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    100
    I get an error message that says that the project you are opening contains compilation errors. I tried this fix, but i don't see any button that says regenerate project files anywhere in the external tools tab?
     
    Last edited: Mar 1, 2023
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    Regenerate project files is not a fix for compilation errors. You have to... actually fix the compilation errors.
     
    Kurt-Dekker likes this.
  3. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    100
    How do i do that, though?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,963
    The complete error message contains everything you need to know to fix the error yourself.

    The important parts of the error message are:

    - the description of the error itself (google this; you are NEVER the first one!)
    - the file it occurred in (critical!)
    - the line number and character position (the two numbers in parentheses)
    - also possibly useful is the stack trace (all the lines of text in the lower console window)

    If it's in your project code, use this guide:

    Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.

    Look in the documentation. Every API you attempt to use is probably documented somewhere. Are you using it correctly? Are you spelling it correctly?

    All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don't have to stop your progress and fiddle around with the forum.

    If it is NOT in your code, check this:

    Extra unwanted packages in new projects (collab, testing, rider and other junk):

    https://forum.unity.com/threads/temp-unityengine-testrunner-dll-error.1133938/#post-7287748

    About the fastest way I have found to make a project and avoid all this noise is to create the project, then as soon as you see the files appear, FORCE-STOP (hard-kill) Unity (with the Activity Manager or Task Manager), then go hand-edit the Packages/manifest.json file as outlined in the above post, then reopen Unity.

    Sometimes the package system gets borked from all this unnecessary churn and requires the package cache to be cleared:

    https://stackoverflow.com/questions/53145919/unity3d-package-cache-errors/69779122
     
  5. Asough

    Asough

    Joined:
    Sep 12, 2022
    Posts:
    100
    Thanks, i will try it out.

    It occurs everytime i try to open the 2d platformer tutorial.

    It says your project was last saved with a different version of unity. The saved project (2021.3.14f1) does not match the launched editor (2021.3.15f1).

    This may require re-import. Please be aware that opening in an older version is unsupported.

    Note that if a build target installation is missing, this may also cause re-import.

    If you proceed, some packages may be updated. For a list of any changes made to your projects packages, see the logs/packages-upgrade.log file in your project folder.

    I changed to version 2021.3.15f1, because it was the recommended version.

    If i click continue, it says the project you are opening contains compilation errors.

    Entering safe mode allows you to resolve these errors without waiting for the rest of your project to import.

    If you select ignore (not recommended), your project will continue to import, but it may be in a broken or unstable state.

    Clicking yes to enter safemode shows me 5 different error messages.

    1. Assets\Tutorials\TutorialCallbacks.cs(2,23): error CS0234: The type or namespace name 'Core' does not exist in the namespace 'Unity.Tutorials' (are you missing an assembly reference?)

    2. Assets\Tutorials\TutorialCallbacks.cs(18,45): error CS0246: The type or namespace name 'FutureObjectReference' could not be found (are you missing a using directive or an assembly reference?)

    3. Assets\Tutorials\TutorialCallbacks.cs(54,35): error CS0246: The type or namespace name 'Tutorial' could not be found (are you missing a using directive or an assembly reference?)

    4. Assets\Tutorials\BuildAndPublish\Criteria\PublishCriteria.cs(2,13): error CS0234: The type or namespace name 'Play' does not exist in the namespace 'Unity' (are you missing an assembly reference?)

    5. Assets\Tutorials\BuildAndPublish\Criteria\PublishCriteria.cs(13,16): error CS0246: The type or namespace name 'PublisherWindow' could not be found (are you missing a using directive or an assembly reference?)

    What do you mean with the line number and the character position?

    Also, i have tried to solve the first error message by opening my project, and then clicking on window, package manager, and then updating all of the packages, as well as reseting the packages to default.

    I still get the same error message everytime i open the project.
     
    Last edited: Mar 1, 2023
  6. ROckeEt141

    ROckeEt141

    Joined:
    Jan 4, 2023
    Posts:
    1
    I have a similar problem, but it happens on every type of project. if this problem is solved on this project, will it happen on another, if you try to create a new one, or try to open an old one?
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,963
    Get it under source control now so if there's a problem you can confidently revert.
     
  8. shevkar

    shevkar

    Joined:
    Oct 16, 2023
    Posts:
    3