Search Unity

Basic file IO with HoloLens

Discussion in 'VR' started by Hololens17, Sep 6, 2017.

  1. Hololens17

    Hololens17

    Joined:
    Sep 6, 2017
    Posts:
    6
    Hey guys!


    I am looking for an easy way to read and write unformatted text from and into files.

    The easiest way I could imagine would be a .txt file, accessed by a C# FileStream.


    To create a file, I need the permission to do so, therefore I need an instance of the FileIOPermission.

    When Unity compiles, everything is ok, but when it builds the app, I get the following two errors:


    error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)#

    error CS0246: The type or namespace name 'FileIOPermission' could not be found (are you missing a using directive or an assembly reference?)


    Any help about fixing this is greatly appreciated. If there is another way to get what I am looking for, I would be happy to read about your suggestion.

    Thanks in advance.
     
  2. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    I would try using the Stream Reader and store the file in the Application.persistentDataPath, I'm able to read and write .txt files this way on the HoloLens
     
  3. eDrawings

    eDrawings

    Joined:
    Nov 8, 2018
    Posts:
    1
    Hi Wesley,

    I use the Application.persistentDataPath also to store and read data using System.IO stream. But it does not work for me. Could you tell me what windows SDK version and Unity Version you are using?

    Thanks,
     
  4. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Hello,

    I'm currently using 10.0.17134.0 windows SDK, could you share a bit more info so I try and help you a little more?

    Thank you,
    Wesley