Workaround for UWP (Universal Windows Platform)
May 18, 2016 ยท View on GitHub
Latest windows store uses UWP for building an app. Unlike regular Unity apps, app for UWP uses dedicated .NET framework which is not compatible with Unity3D-Mono framework.
What's the problem?
When you try to build app using Json.NET.Unity3D for Windows Store, you will get following errors:
UnityException: Failed to run serialization weaver with command ...
(stripped)
Mono.Cecil.ResolutionException:
Failed to resolve System.Runtime.Serialization.Formatters.FormatterAssemblyStyle
(stripped)
UAP doesn't have enum FormatterAssemblyStyle in its assembly and
it should be added to run on windows store.
How to fix?
It's simple. Use original Newtonsoft.Json which contains a DLL for UWP.
- Import Json.Net.Unity3D unity package.
- Create
Assets/UnityPackages/JsonNet/Portabledirectory in unity project. - Download Newtonsoft.Json nuget package and extract it as a zip file.
- Copy
./lib/portable-net45%2Bwp80%2Bwin8%2Bwpa81%2Bdnxcore50/Newtonsoft.Json.dllin the nuget package toAssets/UnityPackages/JsonNet/Portabledirectory. - Watch
Assets/UnityPackages/JsonNet/Newtonsoft.Json.dllwith an inspector, uncheckAny Platformat Select platforms for plugin and Set all platforms checked exceptWSAPlayer. - Watch
Assets/UnityPackages/JsonNet/Portable/Newtonsoft.Json.dllwith an inspector, uncheckAny Platformat Select platforms for plugin and set onlyWSAPlayerchecked.
If you feel complicated, just download
this and extract it to Assets/UnityPackages/JsonNet directory in your project.