unity
io_error
ai_generated
true
AssetDatabase.Refresh failed: Could not refresh asset 'Assets/Resources/data.asset' because the file is locked by another process.
ID: unity/assetdatabase-refresh-failed-locked-file
85%Fix Rate
88%Confidence
1Evidence
2023-02-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Unity 2020.3.0f1 | active | — | — | — |
| Unity 2021.3.0f1 | active | — | — | — |
| Unity 2022.3.0f1 | active | — | — | — |
| Unity 2023.2.0f1 | active | — | — | — |
Root Cause
A file in the project's Assets folder is locked by an external program (e.g., version control, text editor, or antivirus), preventing Unity from reading or writing it during refresh.
generic中文
项目 Assets 文件夹中的文件被外部程序(例如版本控制、文本编辑器或防病毒软件)锁定,阻止 Unity 在刷新期间读取或写入它。
Official Documentation
https://docs.unity3d.com/ScriptReference/AssetDatabase.Refresh.htmlWorkarounds
-
85% success Identify and close the locking process: Use tools like Sysinternals Handle.exe to find which process has a lock on the file. In Command Prompt: handle.exe -a "Assets/Resources/data.asset" then close the identified application (e.g., Notepad++ or Git).
Identify and close the locking process: Use tools like Sysinternals Handle.exe to find which process has a lock on the file. In Command Prompt: handle.exe -a "Assets/Resources/data.asset" then close the identified application (e.g., Notepad++ or Git).
-
80% success Exclude the Unity project folder from antivirus real-time scanning to prevent locks. Then restart Unity and perform a refresh.
Exclude the Unity project folder from antivirus real-time scanning to prevent locks. Then restart Unity and perform a refresh.
中文步骤
Identify and close the locking process: Use tools like Sysinternals Handle.exe to find which process has a lock on the file. In Command Prompt: handle.exe -a "Assets/Resources/data.asset" then close the identified application (e.g., Notepad++ or Git).
Exclude the Unity project folder from antivirus real-time scanning to prevent locks. Then restart Unity and perform a refresh.
Dead Ends
Common approaches that don't work:
-
Run Unity as administrator
80% fail
Administrator privileges do not unlock files held by other processes; the lock persists.
-
Delete the locked file and recreate it
70% fail
Deleting may succeed but the new file can be locked again if the external process is still running.