0
\$\begingroup\$

I'm not sure why this error appears in my console when I start up my Unity editor but it is stopping me from running any Unity projects by pressing the play button.

I have tried re-installing Unity, checking out the file at the specified file path destination and searched my local Unity folders for any relevant files that are calling for a file path search.

I want to know which file is responsible for specifying/assigning the file path causing the error.

The error message is pasted below with a screenshot of the Unity editor (with the error message in its console) and a screenshot of the specified file in the file path:

Error message

DirectoryNotFoundException: Could not find a part of the path "F:\Computer Science\Aston University Work\Final Year (for real)\Game Development\Labs\LabSeven\Workspaces\labSeven_Home_Vers\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, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at :0) System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at :0) (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool) System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean checkHost) (at :0) System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) (at :0) System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) (at :0) System.IO.StreamReader..ctor (System.String path) (at :0) (wrapper remoting-invoke-with-check) System.IO.StreamReader..ctor(string) System.IO.File.ReadAllText (System.String path) (at :0) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.LoadCustomScriptAssemblyFromJson (System.String path) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:463) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.SetAllCustomScriptAssemblyJsons (System.String[] paths) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:681) UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:SetAllCustomScriptAssemblyJsons(String[])

Screen shots

File Screenshot Here

enter image description

Many thanks in advance.

\$\endgroup\$
  • \$\begingroup\$ I'm not completely sure on that one but I think windows has a 260 char limitation for paths. Yours is 265 chars long. Could you check that by copying your project to the desktop or something and try running it from there? Could also be a problem with unity analytics since the exception stated that Unity.Analytics.StandardEvents.EditorTests.asmdef could not be found. Maybe try turning it off for your project. \$\endgroup\$ – TehMightyPotato Mar 14 at 9:30
  • \$\begingroup\$ It would be hard to move the project to desktop. I may use VCS instead if that's the case. Moreover, how would I go about turning off EditorTests.asmdef? \$\endgroup\$ – S B B Mar 24 at 1:17
  • \$\begingroup\$ Check this documentation page. Just turn off the slider shown there. I think analytics is enabled by default when you create a new project. However I would recommend you try running your project from another folder that has a shorter path. If you use a vcs or just copy paste it is your call. \$\endgroup\$ – TehMightyPotato Mar 25 at 8:37
  • \$\begingroup\$ It seems your suggestion to run my project from a shorter file path worked. Thanks man. I'll leave the question open for a bit incase others have answers too. \$\endgroup\$ – S B B Mar 27 at 23:21
  • \$\begingroup\$ Glad I could help. (And good luck with your final year ;) ) \$\endgroup\$ – TehMightyPotato Mar 28 at 8:32
1
\$\begingroup\$

Thanks to TehMightyPotato, the answer is quite straightforward. Make sure the file path for the project is less than 265 characters/bits and the error should not occur.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.