Search Unity

Other Package Manager/Editor Errors

Discussion in 'Editor & General Support' started by GameActuator, Jan 11, 2023.

  1. GameActuator

    GameActuator

    Joined:
    Jul 16, 2022
    Posts:
    10
    Short Story:
    UnityError.png

    Long story:

    I am returning to Unity and have been building a small game as I re-learn. Everything has been great for the past few months, even downloaded some assets that I imported and played around with. No issues, until a few days ago.

    While checking the install tab in Unity Hub I noticed there were two versions of Unity 2021.3.16f1 and 2020.3.43f1. I wanted to see how they were different (big mistake apparently) so I downloaded the 2020 version. After doing this I started to receive the attached error messages. 'No problem', I thought and uninstalled both Unity versions and the Unity Hub then re-downloaded the 2021 version I was originally using This did not fix the issue. I deleted the folders that held my projects I was working on, created new projects, uninstalled everything again, reinstalled everything in new folders, the same error persists.

    See the image attached but basically if I try to create a new project I get a Unity Package Manager Error which says that it failed to update project manifest. If I hit 'Continue' and create the project but then try to open it again I get an Opening Project in Non-Matching Editor Installation message which says the project was saved using a different version of Unity even though Unity 2021 is the only one installed and available when the project was made.

    Now I'm too scared to keep working on my project because I don't trust something won't get corrupted.

    Please help, there's clearly something I'm not understanding or a folder that needs to be deleted but I don't know where to start.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    Nobody should live like that. It's 2023 already. First, get a backup made, then put your project under proper source control. You don't need Unity to do basic good data processing techniques.

    After that, here's some more information:

    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

    Lost progress / project / work / stuff disappeared in Unity.

    This article is to help you when you have lost significant progress or work in your Unity project.

    It is designed to give you avenues of discovery and investigation.

    It is NOT a guarantee of restoring your lost work. It is NOT a substitute for proper IT / Data security procedures.

    To decide which parts are applicable to you, look for major bolded headings.

    EVERYTHING IS GONE, YOU CANNOT OPEN THE PROJECT

    Your project probably is still on your computer. Try a computer-wide search for some unique filenames that you know are in the project you think is gone.

    To start your search, one common file to all Unity projects is named
    ProjectSettings.asset


    Some things that might have happened:

    - you are not opening the project that you think you are
    - you are in the correct project but not opening the same scene you had open before
    - you dragged the project (or part of it) into the trash (intentionally or inadvertently)
    - you moved the project (or part of it) somewhere else (intentionally or inadvertently)
    - an overly-aggressive antivirus solution quarantined it because it saw code being compiled in there
    - you're using a directory sync like OneDrive or Dropbox... NEVER USE THESE SERVICES WITH UNITY!
    - something else??

    As I said, it's probably still all on your system to be found if you look in the right places.

    A typical Unity project will have at a minimum the following folders:

    Assets\
    ProjectSettings\
    Packages\


    EVERYTHING IS PRESENT BUT MY SCENE WINDOW IS BLANK

    Close Unity and make a full project backup RIGHT NOW. Do not do ANYTHING else until you back it up 100%.

    Ideally copy that backup to another computer, or back it up to another external hard drive entirely. This is just basic data processing best practices during data recovery operations.

    If you can see all the files and folders of your project, make sure you are opening the scene file you were working in.

    Once you have opened the scene, look in the hierarchy window, select an object and move the mouse over the Scene window and press F to focus that object.

    Additional notes:

    - ALWAYS use proper industrial grade source control (see below)
    - NEVER use Dropbox or any file sync mechanism in Unity.
    - NEVER move files within your project, except by doing it within Unity
    - ALWAYS be sure you are fully backed up before upgrading Unity

    SCRIPTS OR ASSETS ARE MISSING OR BLANK

    Some info about Missing script warnings, broken prefabs, GUIDs, renaming GUIDs, etc:

    https://forum.unity.com/threads/problem-with-git-and-missing-scripts.1090876/#post-7024801
    https://forum.unity.com/threads/scr...ead-after-loading-editor.998413/#post-6487297
    https://forum.unity.com/threads/scr...ead-after-loading-editor.998413/#post-6488230

    EVERYTHING in Unity is connected to the above GUID, which is stored ONLY in the metafile, and hence why the metafiles ALWAYS MUST be source-controlled.

    When Renaming: It is super-easy to inadvertently change the GUID by renaming outside of Unity. Don't do that. Instead:

    - close Visual Studio (important!)
    - rename the file(s) in Unity
    - in Unity do Assets -> Open C# Project to reopen Visual Studio
    - now rename the actual classes, and MAKE SURE THE FILE NAMES DO NOT CHANGE!

    If you are NOT using source control while you do this, renaming files is an EXTREMELY dangerous process. Use source control at all times so that you can trivially revert if you miss a critical step and damage your project.

    UNITY CRASHES WHEN I OPEN MY PROJECT

    You must isolate if there is something wrong with your Unity installation, something wrong with your project, or perhaps just a corrupted import or asset database.

    First, ALWAYS back your project up. Then try deleting the
    Library/
    and
    Temp/
    folders that are within your project, the directories that are peers to the
    Assets
    and
    ProjectSettings
    folders.

    If that doesn't work it is time to bisect. Make a new empty project and get Unity to open that. If you cannot then it is time to fix your Unity installation, either by fully reinstalling or verifying it with the hub.

    Once you have an empty project open, begin copying over your project. Try the entire thing. If it crashes, try half of the project, then the other half, etc.

    As always, if you're using Windows, another "first thing to try" is to simply reboot the system. This often fixes typical Windows issues related to locked files and locked directories.

    I'm sorry you've had this issue. Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.

    Here is how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally setting Unity up (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It's simply ridiculous not to back up.

    If you plan on joining the software industry, you will be required and expected to know how to use source control.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards
     
  3. GameActuator

    GameActuator

    Joined:
    Jul 16, 2022
    Posts:
    10
    Thanks for the response. There was no way for me to determine if it was Unity or the project or corruption because I was getting errors no matter what I did. I figured it was a temp file or something similar which was causing the error. Took my dad's advice last night, of course after I posted this, and searched all my drives for 'Unity' and found random folder on my main drive. After deleting the file and uninstall.reinstalling the 2021 version. I'm back up and running. Not sure if it was a bad install or what but I'm just glad I can start work again.
     
  4. GameActuator

    GameActuator

    Joined:
    Jul 16, 2022
    Posts:
    10
    Well, the error is back. I realized at least what's causing it. I need my projects in a different drive than my C: drive. After changing the drive location and creating a new project I get these same errors as listed above. Not sure changing the drive location in the Unity Hub is causing the error but we'll see if I can fix it.

    (Edit) When I open Unity this is the error message in the Console tab:

    An error occurred while resolving packages:
    Failed to write dependency lock information:
    An error occurred while writing the file [G:\UnityProjects\CatGuardian\Packages\packages-lock.json]:
    UNKNOWN: unknown error, fsync

    A re-import of the project may be required to fix the issue or a manual modification of G:/UnityProjects/Guardian/Packages/manifest.json file.
     
  5. GameActuator

    GameActuator

    Joined:
    Jul 16, 2022
    Posts:
    10
    This issue was never resolved. The only way I could proceed with my project was to work on it in my C: drive as any other drive would cause the above mentioned errors. This makes no sense to be as I was not moving folders but creating new projects each time correctly through the Hub The editor and Hub are on different drives but the projects have to be on my main drive otherwise it's all errors all the time. No idea why.