I am a Windows Phone developer , but it is my first time to do the porting works from existing Unity games to Windows Phone 8.1 platform.
After some research on Google, there still are some questions confused me:
1, The existing game was wrote in UnityScript & C# mixed, so when I clicked build and tried to open the generated solution for Visual Studio, it reported error that the unityscript proj file is not supported. Is it mean Visual Studio doesn’t support that project developed with UnityScript?
2, If the #1’s answer is true, could MonoDeveloper build the binary for Windows Phone 8.1?
3, Do I need to modify the target framework or even framework’s version?
4, My target is Windows Phone 8.1 (WinRT), WP8.1 itself supports both WinRT&.NET library, but how can I use WinRT Library in Unity? Related question is: Does Unity doesn’t use Mono compiler at all for WP8.1?
First of all keep in mind, that Windows Phone export from Unity is for WP8, not WP8.1.
WP8.1 is under Windows Store Apps as SDK option.
Haven’t heard of an issue like that. Perhaps you messed something up? Export the VS solution to an empty directory.
No, you have to use Visual Studio to build application for Windows Phone.
No, like I said above, there are separate exports for Windows Phone 8 and 8.1. You have to use the proper one, otherwise it won’t work.
We have three compilation options (compilation overrides in Player Settings):
.NET Core (default), which compiles C# scripts using Microsofts compiler and SDK for WP8.1
.NET Core partially, which compiles C# under Plugins, Standard Assets using mono, others use Microsoft compiler.
Mono (named ‘None’ in player settings)
Scripts, that are compiled using Microsoft compiler can use WinRT API. You have to wrap that code with NETFX_CORE define, because otherwise it won’t work in the Editor.
Thanks for your detailed clarification, Aurimas.
I just did a test, created a empty project, and switch to WP8.1(under Windows Store), then add very simple scripts into it, one is a “C# Script” and another is “JavaScript” i.e. UnityScript.
Then I clicked the “Build”, it generated a WP81 project, I tried find the JavaScript file, but failed, only found a Assembly-UnityScript.dll in the “Unprocessed” folder, as its name, I guess, VS2013 didn’t process it. But if I want to do some modification, how can I modify it in VS2013?
And you mentioned, UnityScript is always compiled using Mono, so the result assemble is compatible with MS’s WinRT/.NET?
When you build to WP 8.1, Unity compiles your *.js files into Assembly-UnityScript.dll and references that from generated VisualStudio solution. If you change something in *.js files you’ll need to rebuild from Unity again, so Assembly-UnityScript.dll can be recompiled.
For C# files, we provide an option to generate C# projects, which can be used to recompile Assembly-CSharp.dll after you build the project from Unity, but it’s only supported for C# files… (More info here - http://docs.unity3d.com/Manual/windowsstore-debugging.html)
We make it compatible, as in we provide some of the missing API and patch Assembly-UnityScript.dll after it was compiled
Thank you Tomas.
As I know, current Unity version is default target to .NET 3.5, but WP8.1(WinRT) now is using .NET4.5.x, So do I have a chance to modify the default target .NET framework of Unity when I click the “Build” Buttion in Unity Editor to use more classes?
When you build for WP8.1, you actualy use this newer .NET and the classes are available for you. However, this is not compatible with the editor, you you won’t be able to run your game there. But you can wrap the code with NETFX_CORE, this define is present when building for WP8.1, but not in the editor.