Some types in the System.IO namespace, such as FileStream, are not available in earlier versions of the. New FileStream(Application.persistentDataPath, FileMode.CreateNew) New DataContractJsonSerializer(typeof(SaveData)) SaveData data = new SaveData() // User-defined object to serialize Consider using XmlSerializer or DataContractJsonSerializer instead. However, BinaryFormatter, which serializes an object into binary, is not available in earlier versions of the. It is common for games to serialize save data so that players can't easily manipulate it. NET APIs are missing from the UWP subset, and ways to get around them. The following scenarios describe common issues that might arise where. If you're using a different scripting backend, such as IL2CPP, then use ENABLE_WINMD_SUPPORT instead. NETFX_CORE is only meant to check whether you're compiling C# code against the. Use the following directives to only compile code when running as a UWP app: #if NETFX_CORE NET Framework for standalone desktop and other platforms, and WinRT APIs for UWP, without getting build errors. If you're building your Unity game for multiple platforms, including UWP, you'll want to use platform-dependent compilation to make sure that code intended for UWP is only run when the game is built as a UWP. NET Framework, and thus allow you to use more. In general, for Scripting Runtime Version and Api Compatibility Level, you should select the latest version available so as to have more compatibility with the. This should match the Scripting Runtime Version. ![]() See Scripting Backends for more information.įinally, you should set the Api Compatibility Level to the version of. NET, since that's where the problems discussed here arise. For this topic, we assume you have chosen. NET Standard 2.0), and the API will work. NET Standard), you will get an error when trying to use the API switch it to. NET 3.5 Equivalent (which targets an earlier version of the. If you set the Scripting Runtime Version to. For example, the namespace was introduced in. NET Standard which might allow you to use the same code across standalone and UWP. NET Framework will be supported, only those in the version of. However, keep in mind that not all APIs in that version of the. The Scripting Runtime Version is what the Unity scripting backend uses which allows you to get the (roughly) equivalent version of. Under Other Settings > Configuration, the first three dropdowns ( Scripting Runtime Version, Scripting Backend, and Api Compatibility Level) are all important settings to consider. The first thing you should do if you're having trouble building for UWP is check the Player Settings ( File > Build Settings, select Universal Windows Platform, and then Player Settings). NET Standard that's supported by that version of UWP. NET Standard API Reference and select the version of the. NET API is supported in the UWP version that you're targeting, you can check the. For example, the 16299 SDK (the Fall Creators Update) supports. NET implementation support.Įach version of the UWP SDK conforms to a different level of. You can see a table of standards and implementations at. NET APIs that is meant to be cross-platform, and unify the different. NET Standard is a formal specification of. To understand why some APIs might not be working, it's important to understand the different. (It discusses Windows 8, but is applicable to Windows 10 UWP apps as well.). ![]() NET for Windows 8.x apps overview discusses ways you can convert your code to use WinRT or. However, if the functionality you need is not here. So when you're writing your game, everything might work fine in the editor, but when you go to build for UWP, you might get errors like this: The type or namespace 'Formatters' does not exist in the namespace '' (are you missing an assembly reference?)įortunately, Unity provides some of these missing APIs as extension methods and replacement types, which are described in Universal Windows Platform: Missing. NET Framework for each namespace.Īdditionally, some game engines use different flavors of. NET for UWP apps includes a subset of the types provided in the full. NET, you may find that some APIs that you might use in the Unity editor or for a standalone PC game are not present for UWP.
0 Comments
Leave a Reply. |