Unity打开新项目报错

如下图所示,第一次打开项目的时候报错,
在这里插入图片描述

内容大致为:
FileNotFoundException: Could not find file “D:\GithubProjects\Navigation\VoxelWorldandAstarRoadGenerator\Voxel-World-and-A-star-Road-Generator\Voxel World and A-star Road Generator\Library\PackageCache\com.unity.analytics@3.2.2\Tests\Editor\Unity.Analytics.StandardEvents\Unity.Analytics.StandardEvents.EditorTests.asmdef”.
System.IO.FileStream…ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:305)
System.IO.FileStream…ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.File.OpenRead (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:363)
System.IO.StreamReader…ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamReader.cs:167)

神奇的是,可以按Clear清除掉Console里的内容,就不会报错了,然而点击Play后会有新的报错,但是有没有提示具体问题出在哪里,如下图所示:

在这里插入图片描述
报错内容如下:
All compiler errors have to be fixed before you can enter playmode!
UnityEditor.SceneView:ShowCompileErrorNotification()

如果重新打开Unity,仍然会发现第一个图所示的报错,这就很神奇。

解决办法
根据错误提示FileNotFoundException: Could not find file,应该是文件路径太长了,导致Unity找不到,我的路径有这么长

D:\GithubProjects\Navigation\VoxelWorldandAstarRoadGenerator\Voxel-World-and-A-star-Road-Generator\Voxel World and A-star Road Generator

于是直接把项目移到D盘,发现可以正常运行了

posted @ 2020-09-01 13:37  弹吉他的小刘鸭  阅读(2518)  评论(0编辑  收藏  举报