Thanks for your answers.
1.- [quote=“Tautvydas-Zilys, post:9, topic: 825946, username:Tautvydas-Zilys”]
You’re just missing “using System;”
[/quote]
that works, I I thought that was the job of “using System.Threading;” and “using System.Threading.Tasks;”.
2.- The iteration time beetwen build and build is still too long when I creating the packages with the .sln file (almost 40min) is that normal? I creating only for x64.
3.- I have to ask again if there’s no way to include those WinRT APIs directly in the project like “using Windows.Storage” instead of using “#if ENABLE_WINMD_SUPPORT”? that grayed out the code and no error are shown until I try to build, its like coding on Notepad and hope everything works fine, I’m not that good haha.
4.- After all that anoying things I still have errors in those functions that I try to use in the builded app (open file, folder).
I test another method that I found in here: Launcher.LaunchFolderAsync Method (Windows.System) - Windows UWP applications | Microsoft Learn
which shows a file explorer on UWP.
async void FolderLaunchAsync()
{
//C:\Users\Documents\UnityGames\Imagenes
#if ENABLE_WINMD_SUPPORT
string sPath = @"C:\Users\Documents\UnityGames\Imagenes";
Windows.Storage.StorageFolder folder = await Windows.Storage.StorageFolder.GetFolderFromPathAsync(sPath);
await Windows.System.Launcher.LaunchFolderAsync(folder);
if (folder != null)
{
Debug.LogWarning("OK FOLDER");
//Do something
}
else
{
Debug.LogWarning("NO FOLDER");
//do something
}
#endif
await new WaitForSeconds(0.1f); // added to avoid the CS1998 warning since "await" is under platform dependant code
}
The Unity player shows the next for the first code (openFile):
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
Exception: Exception of type 'System.Exception' was thrown.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000]...
and the next for the second (show file explorer):
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
UnauthorizedAccessException: Attempted to perform an unauthorized operation.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0 ...
I’ll attach the complete log file.
Maybe depelop for UWP on Unity is not that easy (or posible) for those “more specific” functions.
6777494–783959–UnityPlayer.txt (22.8 KB)