x


How do I include a custom file in my build?

I have 6 save game files that are created using C# serialization. I need these files to be included in my build. With a PC version, I can simply copy/paste the needed files into the final build folder. Under Android, due to it packing everything into a *.apk file, I am unable to include the needed game save files. I tried placing them in the Assets/Resources/saves folder and even added a new JS file with the following code:

function Start(){
    Resources.LoadAll("saves");
}

But Unity is still not packing my save files into the build...

How can I tell Unity that these files are required and make them part of the build??

more ▼

asked Sep 21 '11 at 07:32 AM

kingdutka gravatar image

kingdutka
61 6 7 8

Try putting them into a file named Resources

Sep 21 '11 at 08:23 AM asafsitner

Tried the "Resources" folder... still not working. I might resort to creating a 'gaveSaves.js' that is nothing but a list of every variable for each of the game saves... At least that way I know where my info is, how to access it, and am guaranteed it will be included... Downside is the amount of code re-writing...

Sep 26 '11 at 07:44 AM kingdutka

Still seeking an answer to this one... Hoping this comment serves to "bump" my question...

Nov 02 '11 at 07:22 AM kingdutka
(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

I got them working under Android. The problem was resolved when I imported them in the Editor, instead of copying them into the directory.

-arsalank2

Sounds like Occam's Razor!! The best answer is the most obvious... Thanks!!

more ▼

answered Nov 29 '11 at 07:23 PM

kingdutka gravatar image

kingdutka
61 6 7 8

hello, Im trying to do the same thing! its not working... how did u managed to add them using the import inside unity editor? I tried it.... its not adding my files to the built... please advise..

Jan 03 at 04:24 PM geniuscd
(comments are locked)
10|3000 characters needed characters left

Heya,

I'm not developing for Android, so bear with me if this doesn't help you, but I did a quick google to try and find a solution for you.

According to this question on how to save and read data on android, you can either use PlayerPrefs to store the variables that define a saved game, or if the data you need included is unsuitable for PlayerPrefs, you can store the files on the SD card and read/write using Application.persistentDataPath. I think that's the way to do this - you don't need the data embedded in the Unity build.

more ▼

answered Nov 02 '11 at 07:48 AM

CHPedersen gravatar image

CHPedersen
6k 13 22 62

(comments are locked)
10|3000 characters needed characters left

I have exactly same the question. Resources do not seem to work for Android. Does anybody has an answer?

more ▼

answered Nov 24 '11 at 09:34 PM

arsalank2 gravatar image

arsalank2
76 3 4 6

I got them working under Android. The problem was resolved when I imported them in the Editor, instead of copying them into the directory.

Nov 29 '11 at 05:59 PM arsalank2
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x249
x18
x8

asked: Sep 21 '11 at 07:32 AM

Seen: 2887 times

Last Updated: Apr 04 at 01:04 PM