robertohuertasm / SQLite4Unity3d

SQLite made easy for Unity3d
MIT License
1.28k stars 265 forks source link

Unity Build Issue on SQLite Plugins #59

Closed imZEH closed 7 years ago

imZEH commented 7 years ago

Hello,

I just want to ask on how to fix auto copy files inside the folder Plugins when unity Build the app.

sandolkakos commented 7 years ago

I didn't understand what you are talking about. Do you want to know how to copy a file from Resources folder to another place?

imZEH commented 7 years ago

Yes2x. but i think I'm in the wrong section to ask this question. Will Anyway yes I want to auto copy files when building the project.

sandolkakos commented 7 years ago

A simple solution, that I use in my projects:

Put your file in the Resources folder, and rename it to add the ".txt" extension. Example: (mydatabase.db.txt)

Now you can to copy it from Resources to another place, like this:

TextAsset defaultDBTextAsset = Resources.Load("mydatabase.db") as TextAsset; // Dont use the .txt extension
string targetPath = System.IO.Path.Combine(Application.persistentDataPath, "mydatabase.db") ;
File.WriteAllBytes(targetPath , defaultDBTextAsset.bytes);
imZEH commented 7 years ago

I was expecting on unity engine tool you can find something that check configurations , you'll just check some settings. I was not expecting to do some code staff. but Anyways thank you this could be a big help.