Search Unity

Unity keeps deleting my project library when new versions are downloaded

Discussion in 'General Discussion' started by XplorationGames, Dec 21, 2019.

  1. XplorationGames

    XplorationGames

    Joined:
    Oct 31, 2018
    Posts:
    17
    This has now happened to me twice in the past 2 months after building out my resource library in Unity. Thankfully after it happened the first time, I began backing up my asset folder, but now that it's happened a 2nd time, I feel it's worth posting.

    When Unity opens, it does 2 things:
    1) Allows me to choose an existing project to launch
    2) Prompts me to download latest release

    If I do both of these things (which appears to what the sequence was this morning), the project that opens becomes corrupt. I'll end up with the project either missing from Unity Hub or showing an unknown project version. The Library folder on the local drive will then contain no asset folder, and the assets will not be present in my recycle bin. My local drive literally gained about 30 gigs with no deletion performed by me.

    I now have another wiped project. Each time this happens I lose days worth of scripting or resource management.

    Is this simply to be expected with Unity moving forward, or does any seasoned user have suggestions for alternative programs to build out a small commercial project?
     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,145
    What folder have you been choosing?
     
  3. XplorationGames

    XplorationGames

    Joined:
    Oct 31, 2018
    Posts:
    17
    I don't think I understand your question. I'm not choosing any specific folder.

    By default, when adding folders to a project view from within Unity, it uses "<drive>/Unity/Projects/<project name>/Library/Assets". Within that asset folder, the folder hierarchy I create would be reflected (ie ../Assets/Scripts or ../Assets/Prefabs)

    In the scenarios I'm mentioning in my original thread, the entire "Assets" folder goes missing from the hard drive completely, despite no delete actions being performed from my end.
     
  4. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Your Assets folder shouldn't be inside the Library folder. The Library folder is where unity stores things it generates based on the project settings, shader code, etc. You don't for example check the Library folder in to git, it changes between versions and between editors.

    I've no idea how you managed to get Assets inside Library.
     
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,145
    I have never heard of this happening nor should it be happening.
     
    angrypenguin and Joe-Censored like this.
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    In fact I heard of one case before.

    @XplorationGames
    But that is not default directory.
    It could only happen, if user manually selects path, which appears you did.

    upload_2019-12-23_2-43-16.png

    I am unable to check now, but I think default path for Unity projects, is in OS documents directory, or relevant folder.
    So however you set it initially, you just need change it.
     
    Joe-Censored likes this.
  7. XplorationGames

    XplorationGames

    Joined:
    Oct 31, 2018
    Posts:
    17
    I appreciate the attention these responses have shown, but I think they're getting off on a minor point.

    I was incorrect in my reference to "../Library/Assets" . Unity is not putting my Assets folder inside the Library folder. It's putting it in a horizontal directory to Library. That isn't the issue. This mistake was made because at the time of posting I no longer had a project that hadn't been impacted. When now re-confirming, I can say that the Asset folder is directly inside the /Projects/<ProjectName>/ folder.

    The issue is that the Assets folder has been deleted through no action of mine on multiple occasions related to installing updated versions of Unity from the Unity Hub, potentially while a project is open in Unity already. I'm going to update the post title if it will let me to state that it is the project "Assets" that are being removed. Again, this mistake on my part was due to not having a full folder hierarchy in any active project at time of original post, but I can see why my verbiage would lead people to focus on missing "Library" - my concern is the assets that keep getting wiped (prefabs, scripts, etc)

    Below are 3 images.
    Image 1: Me adding a new project (so that the default location can be seen)
    Image 2: Example of what a new project folder structure is by default (I don't modify this, I only end up with additional folder structure within the Assets directory)
    Image 3: Example of a project that has had Unity corrupt and delete folders (none of the missing folders were deleted by me)

    upload_2019-12-23_15-18-6.png

    upload_2019-12-23_15-18-44.png




    upload_2019-12-23_15-20-56.png
     
    Last edited: Dec 23, 2019
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,145
    What are the contents of the root "Unity" folder? Did you create that folder yourself? Or is it the directory for the Unity or Unity Hub applications?
     
  9. XplorationGames

    XplorationGames

    Joined:
    Oct 31, 2018
    Posts:
    17
    A lot of things. Below is a screenshot of about half of it. I may have chosen this folder during Unity Hub initial install. I don't recall.

    The first two folders are the versions downloaded. The first time I had my project assets wiped was when I installed 2019.2.11f1.

    This last time was when I installed 2019.2.17f1

    Again, I'm pretty sure I had a project open in Unity while simultaneously downloading/installing a new version from Hub.

    upload_2019-12-24_9-40-40.png
     
  10. XplorationGames

    XplorationGames

    Joined:
    Oct 31, 2018
    Posts:
    17
    Here's the bottom half in the event there is something material there.

    upload_2019-12-24_10-4-10.png
     
  11. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Firstly, your problem will be immediate gone, when change project directory away from Unity folder, where you install program.

    Somehow you install in Unity dir, rather Unity/Unity Version. Which of course will bring that whole mess.
     
    zombiegorilla likes this.
  12. XplorationGames

    XplorationGames

    Joined:
    Oct 31, 2018
    Posts:
    17
    You say "of course" without providing any meaningful reason this would be obvious. If Unity is known to randomly wipe folders buried within its directory, why would it pick random folders within the "Projects" directory and not just wipe the entire "Projects" folder? I expect this will end up being a rhetorical question.

    This isn't a solution, but I'll do this moving forward. And if you're actually curious how I "somehow" install in Unity dir, it's easy. I picked it when I installed.
     
  13. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Most applications keep program files and data files quite separate, it's even built in to most operating systems ('Program Files vs My Documents', '/Applications vs Documents', '/usr/bin vs /home' etc).

    So although the exact behaviour you observe is strange, its not at all surprising that putting data files inside the program directory causes issues.

    Installers are notorious for including all kinda of hacks to make things work, for example searching for a certain filename pattern and wiping out the parent directory (this could, for example, be some installer code that tries to clear out the older unity samples if you have them installed).

    Separating these two things is not an explanation, but it is a solution (not to mention one that is aligned with standard practices for most software).
     
    Last edited: Dec 27, 2019
  14. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,145
    You didn't pick that when you installed Unity. When you install Unity Hub you select an installation folder and from then on the hub manages everything strictly related to the editor like the installation folders for the editors. This and your current account info are all the hub handles which is why some people find the hub annoyingly pointless.

    The only way you would have had a project there is if you manually pointed at that folder when you created your project through Unity Hub. Below is a screenshot from a freshly installed copy of Unity Hub. Note that it is pointing at the users folder for my Windows account.

    I know all this is because I prefer a custom location (C:\Projects) and have to redirect it every time I reinstall Windows.

    upload_2019-12-27_0-17-43.png
     
    Last edited: Dec 27, 2019
    Antypodish likes this.
  15. XplorationGames

    XplorationGames

    Joined:
    Oct 31, 2018
    Posts:
    17
    I appreciate both, and as I said in my last post, I will take the advice moving forward. I have reasoned this on my own since thinking over this, and I appreciate both responses since then.

    However @Ryiah as I showed in the screenshots I put up above, I didn't modify the project paths - those are the defaults. So I must have established the default folder path at install of Hub. That was my point. I understand yours as well.