コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】Error detecting Visual Studio installations: System.ArgumentException: JSON parse error: Invalid escape character in string(2020/9/20更新)

はじめに

Error detecting Visual Studio installations: System.ArgumentException: JSON parse error: Invalid escape character in string.
  at (wrapper managed-to-native) UnityEngine.JsonUtility.FromJsonInternal(string,object,System.Type)
  at UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) [0x0005c] in <1386288601af43018501cce2912f52f4>:0 
  at UnityEngine.JsonUtility.FromJson[T] (System.String json) [0x00001] in <1386288601af43018501cce2912f52f4>:0 
  at Microsoft.Unity.VisualStudio.Editor.Discovery+VsWhereResult.FromJson (System.String json) [0x00001] in UnityProject\Library\PackageCache\com.unity.ide.visualstudio@2.0.2\Editor\Discovery.cs:93 
  at Microsoft.Unity.VisualStudio.Editor.Discovery.QueryVsWhere () [0x000b1] in UnityProject\Library\PackageCache\com.unity.ide.visualstudio@2.0.2\Editor\Discovery.cs:160 
  at Microsoft.Unity.VisualStudio.Editor.Discovery+<GetVisualStudioInstallations>d__0.MoveNext () [0x0003e] in UnityProject\Library\PackageCache\com.unity.ide.visualstudio@2.0.2\Editor\Discovery.cs:22 
  at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x0005e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor..cctor () [0x00002] in UnityProject\Library\PackageCache\com.unity.ide.visualstudio@2.0.2\Editor\VisualStudioEditor.cs:36 
UnityEngine.Debug:Log(Object)
Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor:.cctor() (at Library/PackageCache/com.unity.ide.visualstudio@2.0.2/Editor/VisualStudioEditor.cs:42)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])

Unity プロジェクトを 2019.4.6f1 にバージョンアップしたところ
コンパイル完了後に上記のログが出力されるようになった

これは Unity パッケージの「Visual Studio Editor」を
「2.0.3」にアップデートすることで解決します

アップデート方法

f:id:baba_s:20200916100707p:plain

Unity メニューの「Window > Package Manager」を選択して

f:id:baba_s:20200920214530p:plain

表示された Package Manager ウィンドウで
「Visual Studio Editor」を選択して「Update to 2.0.3」を押します

f:id:baba_s:20200920214550p:plain

少しすると更新が始まるので待ちます

f:id:baba_s:20200920214552p:plain

更新が完了して Package Manager ウィンドウに「2.0.3」と表示されていれば更新完了です

これで前述したログが出力されなくなります

参考サイト様