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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Creating game info file ( like xml ) when building game

Discussion in 'Scripting' started by imosek8, May 24, 2015.

  1. imosek8

    imosek8

    Joined:
    Apr 24, 2015
    Posts:
    10
    Hello! I have a game object in which I load data from xml file ( by deserialization ). I built my app for android. When I run the game there is no data loaded. It seems like there is no file copied from my pc. It is possible to save this file (xml) in .apk when building?

    Maybe is a good idea to check if the file exists? - if not just write new data in it, and load again?
     
    Last edited: May 24, 2015
  2. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Generally for most cases people check the persistentDataPath for the file, and if it dosnt exist they create one with defualt values.
     
  3. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
  4. imosek8

    imosek8

    Joined:
    Apr 24, 2015
    Posts:
    10
    So, if I want to change something is better to use persistentDataPath?
     
  5. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Yes, that is a path you get access to that is read and write.
     
    imosek8 likes this.