Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug System.IO not working for brokered filesystem locations in UWP with Unity 2021 (regression)

Discussion in 'Windows' started by holo-krzysztof, Jan 17, 2023.

  1. holo-krzysztof

    holo-krzysztof

    Joined:
    Apr 5, 2017
    Posts:
    74
    I have the following code:

    Code (CSharp):
    1. using System.IO;
    2. using UnityEngine;
    3.  
    4. #if ENABLE_WINMD_SUPPORT
    5. using Windows.Storage;
    6. #endif
    7.  
    8. public class Test : MonoBehaviour
    9. {
    10.     void Start()
    11.     {
    12.         string localPath = Path.Combine(Application.persistentDataPath, "TestDir");
    13.      
    14.         try
    15.         {
    16.             Directory.CreateDirectory(localPath);
    17.             Debug.Log("Directory created successfully");
    18.         }
    19.         catch (System.Exception ex)
    20.         {
    21.             Debug.LogException(ex);
    22.         }
    23.  
    24.         try
    25.         {
    26.             Objects3DTest();
    27.         }
    28.         catch(System.Exception ex)
    29.         {
    30.             Debug.LogException(ex);
    31.         }
    32.     }
    33.  
    34.     [System.Diagnostics.Conditional("ENABLE_WINMD_SUPPORT")]
    35.     void Objects3DTest()
    36.     {
    37. #if ENABLE_WINMD_SUPPORT
    38.         try
    39.         {
    40.             string path = Path.Combine(KnownFolders.Objects3D.Path, "TestDir");
    41.  
    42.             Directory.CreateDirectory(path);
    43.             Debug.Log("Direcotry in Objects3D created successfully");
    44.         }
    45.         catch (System.Exception ex)
    46.         {
    47.             Debug.LogException(ex);
    48.         }
    49. #endif
    50.     }
    51. }
    52.  
    Objects3D permission is enabled in the app manifest.
    With Unity 2020.3.43 it works fine. After switching to Unity 2021.3.16 the Objects3D case does not work anymore, which prevents us from upgrading (our project needs to run on HoloLens).

    Case number is IN-29088.
     
    Last edited: Jan 17, 2023
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,420
    holo-krzysztof likes this.
  3. holo-krzysztof

    holo-krzysztof

    Joined:
    Apr 5, 2017
    Posts:
    74
    Awesome, thanks!

    Do you know by chance when the fix will land in 2021 LTS? We're trying to estimate whether to go forward with the upgrade or to stay on 2020 for another 3 or so months.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,420
    We are planning to land it to 2021.3.