FATAL ERROR: trying to write to readonly database

I have a project made in Unity 4.6. I am upgrading it to Unity 5. Everything seemed to be fine at first. But when I delete folders or files that I don’t need in the project I get the FATAL ERROR message and I can only press the “QUIT” button.

Once that happened every time I try to reopen the project I get the very same error on opening. It’s frustrating. To get rid of it I have to reopen the project in Unity 4.6 (I got 2 versions of Unity running on my computer), downgrade it, and then reopen it in Unity 5 and upgrade it. After that everything seems “fine” again. But once I try and delete a directory\file (Or even change its location) I go through the same vicious cycle.

That’s what the Editor.log file look like after the error:

*-----CompilerOutput:-stderr----------
-----EndCompilerOutput---------------

  • Finished compile Library/ScriptAssemblies/Assembly-UnityScript.dll
    Assets/Tools/ShowFps.js(34,34): BCE0144: ‘UnityEngine.GameObject.guiText’ is obsolete. Property guiText has been deprecated. Use GetComponent() instead. (UnityUpgradable)*

(Filename: Assets/Tools/ShowFps.js Line: 34)
Refresh: detecting if any assets need to be imported or removed … Refresh: elapses 0.017538 seconds
Refresh: trashing asset fa5fac99c2b052b4e89678c65cae204e
attempt to write a readonly database

(Filename: C:/buildslave/unity/build/External/sqlite/SQLite.cpp Line: 345)

Help me solve this heartbreaking problem please. Thanks in advance.

The solution depends on what caused the issue (adding to version control, moving the project, etc), but the common solution is to perform the following steps, where applicable:

  • Move the project back to an internal hard drive, as external drives cause this issue
  • Recursively set the project directory as Read-Only, then set it back to Read-Write

I had this issue on an external drive, but reformatting it within Disk Utility on the Mac to use “Mac OS Extended (Journaled)” filesystem (not case-sensitive), it worked. It was originally set to using NTFS, which didn’t work.

What worked for me is a variation of @LoungeKatt 's answer, the permissions thing didn’t work (macOS), but moving the project files to my main partition worked.