Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Bug The project you are opening contains a locked library

Discussion in 'Editor & General Support' started by sardarovgabriell, May 9, 2023.

  1. sardarovgabriell


    Apr 11, 2020
    When I'm opening my only project in unity, it firstly loads the start scene, an then writes an errror - "The project you are opening contains a locked library", with other projects, it shows me a window "The project you are opening contains compilation errors" and no matter what i click - it closes/crashes.
    I don't know exactly what the cause of the problem might be, but i was extracting(ctrl + x) all my unity projects to another disc, and when i was extracting other folders it was taking long time, so while it was extracting the folders i just shutted off the pc.
    Second variation is that last time i have maanny problems with unity projects, sometimes it was the VS problem, sometimes it was editors problem, and i changed my projects editor versions many times from what editor it was made on.
  2. Kurt-Dekker


    Mar 16, 2013
    Perhaps there is antivirus quarantining binaries in Unity. Tell your AV to ignore any folders you use for Unity development.

    Otherwise, errors do have answers and you can dig them up yourself:

    Remember: NOBODY here memorizes error codes. That's not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

    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)

    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.

    YIKES!! Yuck...


    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:

    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:

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

    Share/Sharing source code between projects:

    Setting up an appropriate .gitignore file for Unity3D:

    Generally the ONLY folders you should ever source control are:


    NEVER source control Library/ or Temp/ or Logs/
    NEVER source control anything from Visual Studio (.vs, .csproj, none of that noise)

    Setting git up with Unity (includes above .gitignore concepts):

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


    May 11, 2019
    Hi there. I solved mine by deleting the Temp and Library folder inside the Unity project after closing the unity hub and unity fully. When you open the project after this Unity will reinstall all packages and that fixes it.
    RaulChatham likes this.
  4. nickluft


    Dec 6, 2023
    I deleted "UnityLockFile" from the Temp folder and the Unity project restarted.

  5. wechat_os_Qy0xDfW7_FXo5lVaICGD12FD8


    Jul 9, 2023
    Solved by deleting Temp and Library folder inside the Unity project then restarting the computer.