Search Unity

writing user accessible files on ios/android

Discussion in 'Scripting' started by alphabeta314, Mar 10, 2021.

  1. alphabeta314

    alphabeta314

    Joined:
    Jul 23, 2015
    Posts:
    47
    How can I write say text files on a android and iOS app which the user can then open and read? Say I write a csv file or a image and want the user to be able to view them, where do I find the path in Android and iOS to do this?
    Thanks
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,914
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,752
    This is completely outside of Unity.

    It will be different for iOS and Android. The details will be on the developer sites for each OS.

    It will involve least some combination of the following:

    - determining what kind of file you want (photo? text? PDF? other?)

    - determining if the user has an app that can open that installed or not

    - determining where that app expects to find documents

    - determining what permissions your app must have to write the file (different for each of the above)

    - possibly other permissions and/or metadata that needs to be told to the OS so it can open those files outside of your Unity program

    If you just want to persist stuff to disk and open it later in your program, the link above from Praetor will let you write/read those files, generally speaking.
     
    PraetorBlue likes this.