How to integrate windows APIs to my unity app???
Hello all!!!
I'm trying to migrate my unity Windows standalone app to UWP in order to put it on the Windows Store. I have been able to build my app for my Windows 10 desktop and test it but still have some APIs that have to remove-replace in order to pass succesfully the Certification app and be able to submit it to the store, for example my old file manager to open-save files that use Windows.forms and replace it for this:
https://learn.microsoft.com/en-us/windows/uwp/files/quickstart-using-file-and-folder-pickers
Plus I would like to take advantage from the store and sell subscrption in my app and integrate somethinf like this:
https://learn.microsoft.com/en-us/windows/uwp/monetize/enable-subscription-add-ons-for-your-app
The problem with both solutions is that I don't know how to integrate those Windows APIs to my project in Unity.
I have trying something like this:
public void OpenFile()
{
FilePicker();
}
async void FilePicker()
{
#if ENABLE_WINMD_SUPPORT
var picker = new Windows.Storage.Pickers.FileOpenPicker();
picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
picker.FileTypeFilter.Add(".jpg");
picker.FileTypeFilter.Add(".jpeg");
picker.FileTypeFilter.Add(".png");
Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
Debug.Log(file.Name);
}
else
{
Debug.Log("Operation cancelled");
}
#endif
But with no good results at all. Is there a guide or something on good practices or how to integrate those APIs in Unity?
I will appreciate any help. Thank you in advance.