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

Bug Project Isn't Working 100% After Deleting Library Folder

Discussion in 'Editor & General Support' started by AdamEarlston, Jan 16, 2023.

  1. AdamEarlston

    AdamEarlston

    Joined:
    Jun 7, 2019
    Posts:
    71
    I had a bunch of errors last night when trying to build my game (worked in the past), and after a bunch of googling and nothing working, it seemed like several people had a fix by deleting the Library folder..

    So I made a backup version (copy pasted the project folder to a new folder) then deleted the Library, launched Unity and waited a few hours for it to re-import like 40gbs of files. But now it pops up saying it's my first time using TextMeshPro and asking if I want to install the Essentials (every time I play a scene) and at least one of my scripts have stopped working.

    So then I opened up my Backup project and I had the exact same issues, how? It's like the Library folder was rebuilt in both projects at the same time or something.(But my backup Library has files from 2021(Last Modified) so it wasn't changed? idk)

    https://prnt.sc/bdKjYRshZN6G
    https://prnt.sc/Ju_kgDvOWK14

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.InspectorWindowUtils.GetFirstNonImportInspectorEditor (UnityEditor.Editor[] editors) (at <744208b08e5641cc88f88825989c3044>:0)
    UnityEditor.InspectorWindow.GetInspectedObject () (at <744208b08e5641cc88f88825989c3044>:0)
    UnityEditor.PropertyEditor.OnDisable () (at <744208b08e5641cc88f88825989c3044>:0)
    UnityEditor.InspectorWindow.OnDisable () (at <744208b08e5641cc88f88825989c3044>:0)
    UnityEditor.EditorApplicationLayout:InitPlaymodeLayout()

    Also it seems like what i thought was a broken script, is actually just not working becuase of the PlayerPrefs being reset.

    So basically I don't understand why TextMeshPro is constantly asking me to install the essentials, and still does if I do. And why my Backup project is affected by what i did on another project?
    I am using Editor Version 2020.3.39f1
     
    Last edited: Jan 16, 2023
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Usually nullrefs in the inspector window stack are transient and will rectify with a reimport, unless some piece of data is damaged, in which case it would be necessary to revert or rebuild that piece of data.

    There are very specific conditions that must be set up before this approach will work, specifically visible text files, text serialization, etc., all the normal setup for proper version control.

    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. AdamEarlston

    AdamEarlston

    Joined:
    Jun 7, 2019
    Posts:
    71
    Thanks for the info, i've tried Git in the past a couple of times but never ended up using it because of my project being too big for the free version or something. It's just a passion project/hobby for me so i do use scuffed tactics at times and do things lazily since i only have to do it once type of thing. But i will 100% do things better in my next project and use Git (This is still my first project ever pretty much).

    After i fix the TMPro issue which seems like a simple fix atm, i'll look into doing it properly this time with what you listed, thanks :D

    But one thing that i don't understand still, why was my backup version affected by what i did in a different project? Because i have an extra backup on a HDD but i'm scared to touch that backup until i understand why and if the changes will happen to that one too.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    This only applies to free hosting services.

    Git itself is always free and can store any size of files you want.

    That said, you MUST use the proper .gitignore or you will be wasting massive amounts of storage by committing things you don't need to.

    You can always "push" or "pull" your repos to an external thumb drive, or even host your own git server if you have a second computer.

    No way to tell without doing a full-on forensic dive into things. At the end of the day these things are almost unversally explained by either a file you didn't realize was shared, or you just opened the wrong project one time.

    But with source control you get an indelible record of all changes against your repo, which facilitates easy damage recovery and forensic investigation of how things went wrong.