Answer the question
In order to leave comments, you need to log in
Why is db not migrated from streamingAssets to persistentData on Android games (Unity)?
I'm trying to use the sqlite database in the game.
On my android, the game works fine, although I struggled for a long time to unload it from Streaming Assets to Persit persistentDataPath. Released it on Google play. A friend downloaded it, but his base from Streaming Assets was not transferred to Persit persistentDataPath.
if (Application.platform == RuntimePlatform.Android)
{
_path = Get_path();
if (!File.Exists(_path))
{
var loadingRequest = UnityWebRequest.Get(Path.Combine(Application.streamingAssetsPath, "RM_db_test.bytes"));
loadingRequest.SendWebRequest();
while (!loadingRequest.isDone) { }
File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "RM_db_test.bytes"), loadingRequest.downloadHandler.data);
}
}
else if (Application.platform == RuntimePlatform.IPhonePlayer)
{
_path = Get_path();
if (!File.Exists(_path))
{
_path = Application.streamingAssetsPath + "/RM_db_test.bytes";
File.Copy(_path, Application.persistentDataPath + "/RM_db_test.bytes");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question