Search Unity

Where put my Sqlite base into my unity project

Discussion in 'Scripting' started by usasacm, Dec 1, 2012.

  1. usasacm

    usasacm

    Joined:
    Nov 24, 2012
    Posts:
    8
    Ok, I'm understood how to read data from base, but after compile the project my Application.dataPath is changing. For example:
    in Unity my Application.dataPath is C:\Project\Assets\my.sqlite after compile my Application.dataPath is C:\Project_Data\.
    And after compile I not see my.sqlite base in C:\Project_Data, what I must doing that compile my project with database?
    I tryed put my base into the C:\Project_Data, but after runing my exe is not see database.
    But when I runing tat into the Unity everything works fine. Heeeeeeeeeeeeeeeelp pleeeeeeeeeeeeaaaaaaaaas
     
  2. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Use a relative path for your connection string...

    Code (csharp):
    1. static string _connString = @"Data Source=.\myProjectName_Data\mydatabase.db;Version=3;";
    myProjectName_Data is the data folder when your game is built.
    Create this folder under your \Assets folder too so it can work in the editor as well.
     
  3. usasacm

    usasacm

    Joined:
    Nov 24, 2012
    Posts:
    8
    hi all!
    I do some things:
    Create folder StreamAssets and put into my Database
    Put my Plugins folder into Assets folder
    To connect database I use Application.dataPath
    And my project compile correctly.

    Thank you Meltdown for responding!