Windows Store Build setting details from script

I have to repeatedly test my project with Unity 4.7 thru 5.3, and even 5.4 beta.
Because I need to open the same project with so many versions of Unity, my asset files tend to get corrupted, so saving settings in the editor is pointless.

In my tests, I do builds for a bunch of different platforms, like android, wp8, ios, etc.

I have managed to stabilize most of my builds with lines like this:

#if UNITY_5
            BuildTarget appleBuildTarget = BuildTarget.iOS;
#else
            BuildTarget appleBuildTarget = BuildTarget.iPhone;
#endif
            PlayerSettings.SetPropertyInt("ScriptingBackend", (int)ScriptingImplementation.Mono2x, appleBuildTarget); // Test builds are faster with Mono2x

I have not yet figured out how to set any of the “Windows Store” options from script.
Additionally, it has more options that need to be consistently reset, and I can’t find documentation that describe the options I need.

Specifically:

  • I’d like to set the SDK to “Universal 8.1”
  • I’d like to set “build and run on”, to be “Local Machine and windows phone”
  • I’d like to set “Unity C# projects” to be true
  • I’d like to set “Publishing Settings → Capabilities → InternetClient” to be true

These options all exist on all versions from 4.7 thru 5.3. I imagine it’s probably more SetPropertyInt calls, but I don’t know what strings are valid for that function.

I eventually reflected the entire UnityEditor Assembly and found everything that matched the enum types I found in my comment.

Here’s the answer:

            EditorUserBuildSettings.wsaSDK = WSASDK.UniversalSDK81;
            EditorUserBuildSettings.wsaBuildAndRunDeployTarget = WSABuildAndRunDeployTarget.LocalMachineAndWindowsPhone;
            EditorUserBuildSettings.wsaGenerateReferenceProjects = true;
            PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClient, true);

It’s pretty disappointing that this isn’t documented anywhere in the Unity site.