Squidley
Squidley

Reputation: 53

Unity error immediately after creating a new Project

When creating a new 3D project in Unity (version 2019.3.3f1), I got an error in the Unity console without making any change or doing anything within Unity.

The Error:

IndexOutOfRangeException: Index was outside the bounds of the array. VSCodeEditor.ProjectGeneration.b__25_0 (System.String asset) (at Library/PackageCache/[email protected]/Editor/ProjectGeneration/ProjectGeneration.cs:175)

And the line of code supposedly wrong is from the file created w/ the Project called projectGeneration.cs.

var affectedNames = affectedFiles.Select(asset => m_AssemblyNameProvider.GetAssemblyNameFromScriptPath(asset)?.Split(new [] {".dll"}, StringSplitOptions.RemoveEmptyEntries)[0]);

Upvotes: 1

Views: 3927

Answers (3)

Akash Gusain
Akash Gusain

Reputation: 11

Downgrade visual studio code version to 1.1.3 to fix this error

Open Unity, then go to: Window->Package Manager->Visual Studio Code 1.1.3

After that, just restart Unity and it will fix the error.

Upvotes: 0

Mikey Bally
Mikey Bally

Reputation: 454

I had the same problem.

The solution for me was to install .NET Framework 4.7.1 Developer pack from:- https://dotnet.microsoft.com/download/dotnet-framework/net471

This is quite an old version, however this was the version requested by OmniSharp in the output window of VS Code.

Note: This solution works with even the 1.2.0 version of the Visual Studio Code Editor package.

Upvotes: 0

proton
proton

Reputation: 11

Go into your Unity Package Manager and find the Visual Studio Code package. Click 'see all versions'. Change the versions and try downgrading/updating (Sadly I don't know which version is compatible). Restart Unity and it should be fixed.

Upvotes: 1

Related Questions