LoginSignup
3
1

More than 3 years have passed since last update.

[Unity] ビルド時に Json.NET が動かない問題 PlatformNotSupportedException

Posted at

JsonUtility で Dictionary が使えなかったことにイライラしたので、 Json.NET を入れました。
Editor 上で Play する分には問題なく動いてくれましたが、 Build And Run すると、どうも上手くファイルが読み込まれていないようでした。

Development Build で確認すると、エラーメッセージが表示されました。
PlatformNotSupportedException: Operation is not supported on this platform.
そして二行目には、 Newtonsoft.Json の文字が。

解決法

https://github.com/JamesNK/Newtonsoft.Json/issues/2046
にある通り、 Player Settigns にある Api Compatibility Level.NET 4.x に変更すると動くようになりました。

しかしこの方法には少し問題があるようで、
https://docs.microsoft.com/ja-jp/visualstudio/cross-platform/unity-scripting-upgrade?view=vs-2019
にある通り、動かないプラットフォームがある可能性がある、ということを知っておくべきでしょう。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1