Search Unity

Text File Location Problem

Discussion in 'Scripting' started by PatrickDuncan, Aug 1, 2015.

  1. PatrickDuncan

    PatrickDuncan

    Joined:
    Jul 9, 2015
    Posts:
    11
    Hello, I'm making a 2D game and I want a file which has the default positions of every single enemy (so when you die they go back to the position). I know how to read in files etc. but my problem is the location of the file. I load in the file and read off the positions fine in unity, but when I build to an .exe it does its mojo and changes around the assets. I searched the exe and exe data and couldn't find the file.

    So basically what's the best practice for reading in important data? I could just create a really long array and have a load function, but seems a little "barbaric".

    Thanks~
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Throw it in the resources folder and load it with Resources.Load

    For runtime saving use Application.persistantDataPath