Unity C#项目崩溃重启后报Could not load type Readme错误求助
解决Unity重启后TypeLoadException无法加载Readme类型的问题
错误信息
TypeLoadException: Could not load type Readme, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null while decoding custom attribute: (null) System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) (at <3dd5df5ef4974f29afeb2d3ba227c5da>:0) System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) (at <3dd5df5ef4974f29afeb2d3ba227c5da>:0) System.RuntimeType.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) (at <3dd5df5ef4974f29afeb2d3ba227c5da>:0) UnityEditor.CustomEditorAttributes.Rebuild () (at <8a1c902e1cc24cec8e4dda915647a0cd>:0) UnityEditor.CustomEditorAttributes.FindCustomEditorTypeByType (System.Type type, System.Boolean multiEdit) (at <8a1c902e1cc24cec8e4dda915647a0cd>:0) UnityEditor.CustomEditorAttributes.FindCustomEditorType (UnityEngine.Object o, System.Boolean multiEdit) (at <8a1c902e1cc24cec8e4dda915647a0cd>:0) UnityEditor.SceneView:Awake() UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String) UnityEditor.WindowLayout:LoadDefaultWindowPreferences()
解决方案
清理Unity缓存与编译文件
关闭Unity,删除项目根目录下的Library、obj、bin文件夹,重新打开Unity等待资源重新导入编译。这些文件夹是Unity自动生成的缓存和编译产物,系统崩溃后大概率出现损坏。检查Readme相关代码与自定义编辑器
搜索项目中所有脚本,确认Readme类状态:- 若
Readme脚本丢失,从备份恢复;若脚本损坏,重新编写或替换为完好版本。 - 排查自定义编辑器脚本中的
[CustomEditor(typeof(Readme))]特性,若Readme类已不存在,直接移除该特性或修正类型引用。
- 若
重置Unity编辑器布局
打开Unity后,点击顶部菜单Window->Layouts->Reset to Factory Settings;也可手动删除编辑器偏好设置文件:- Windows路径:
C:\Users\[你的用户名]\AppData\Roaming\Unity\Editor-5.x\Preferences - Mac路径:
~/Library/Preferences/Unity
删除文件后重启Unity,重置编辑器状态。
- Windows路径:
验证项目文件完整性
若使用Git等版本控制工具,拉取最新的完整代码;无版本控制时,检查是否有损坏的.meta文件,删除损坏文件后重新导入对应资源。
内容的提问来源于stack exchange,提问作者BigFungus05
相关产品推荐
相关产品推荐

