Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.92 KB

UwpWorkaround.md

File metadata and controls

44 lines (34 loc) · 1.92 KB

Workaround for UWP (Universal Windows Platform)

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.

  1. Import Json.Net.Unity3D unity package.
  2. Create Assets/UnityPackages/JsonNet/Portable directory in unity project.
  3. Download Newtonsoft.Json nuget package and extract it as a zip file.
  4. Copy ./lib/portable-net45%2Bwp80%2Bwin8%2Bwpa81%2Bdnxcore50/Newtonsoft.Json.dll in the nuget package to Assets/UnityPackages/JsonNet/Portable directory.
  5. Watch Assets/UnityPackages/JsonNet/Newtonsoft.Json.dll with an inspector, uncheck Any Platform at Select platforms for plugin and Set all platforms checked except WSAPlayer.
  6. Watch Assets/UnityPackages/JsonNet/Portable/Newtonsoft.Json.dll with an inspector, uncheck Any Platform at Select platforms for plugin and set only WSAPlayer checked.

If you feel complicated, just download this and extract it to Assets/UnityPackages/JsonNet directory in your project.