Back to Blog
20 May 2020
60 Views
"Unity Windows Store: Use #NETFX_CORE for Mono & #ENABLE_WINMD_SUPPORT for IL2CPP builds to open the store page. Code snippets included!"
There is a trick here, you need a different conditional define for Mono Builds and another for IL2CPP builds!
Mono Builds
#if NETFX_CORE
string productID = Windows.ApplicationModel.Package.Current.Id.FamilyName;
Application.OpenURL("ms-windows-store://pdp/?ProductId=" + productID);
#endifIL2CPP Builds
#if ENABLE_WINMD_SUPPORT
string productID = Windows.ApplicationModel.Package.Current.Id.FamilyName;
Application.OpenURL("ms-windows-store://pdp/?ProductId=" + productID);
endifThe real trick is to use the #ENABLE_WINMD_SUPPORT conditional define for IL2CPP builds or #NETFX_CORE for Mono Builds.
References :
https://docs.unity3d.com/Manual/windowsstore-code-snippets.html
https://docs.microsoft.com/en-us/windows/uwp/gaming/missing-dot-net-apis-in-unity-and-uwp#feedback
Comments
Be the first to comment!
