Hi there,
I have a problem with my cloud sync funktion in my neweest Unity project:
I have several identical builds on different laptops or desktop computers. So every build should use just one sync file on my webspace.
If I start a build and there is no local save file the sync works and can download the latest save file.
But if the build uploads the newest data it opens another database entry instead of using the first one. The problem is the persistent data path: Because of the other user name on another laptop or desktop computer the filename in the database is different.
Which filepath should i use instead? "C:" for example could be a little bit unsafe.
ES3 Cloud Sync Problem with persistent DataPath
Re: ES3 Cloud Sync Problem with persistent DataPath
Hi there,
Please could you show me the code you are using? It shouldn't upload with an absolute path unless you are specifying an absolute path. For example:
... should upload with MyFile.es3 as the identifier, not C:\Username\AppData\LocalLow\<companyname>\<productname>\MyFile.es3.
All the best,
Joel
Please could you show me the code you are using? It shouldn't upload with an absolute path unless you are specifying an absolute path. For example:
Code: Select all
cloud.Sync("MyFile.es3");
All the best,
Joel
Re: ES3 Cloud Sync Problem with persistent DataPath
Hey again,
yea that should be the problem. So I should use the comment one line above, right? _filepath is just my local save file "filename.json"
yea that should be the problem. So I should use the comment one line above, right? _filepath is just my local save file "filename.json"
Code: Select all
private void Awake()
{
// JSON Dateiname und Einträge aus anderem Script abrufen
_filePath = GetComponent<InputHandler>().filename;
}
private void Start()
{
StartSync();
}
IEnumerator Sync()
{
// Create an ES3Cloud object with our URL and API key.
var cloud = new ES3Cloud(url, apiKey);
// Change the button text to show we're uploading.
synctatus.text = "Versuche Upload ...";
// Upload the default file to the server.
// yield return StartCoroutine(cloud.Sync(_filePath));
yield return StartCoroutine(cloud.Sync(Application.persistentDataPath + "/" + _filePath));
// Now check that no errors occurred.
if (cloud.isError && synctatus)
{
synctatus.text = "Keine Verbindung.";
synctatus.color = new Color(221, 0, 0);
Debug.LogError(cloud.error);
Debug.LogError(cloud.errorCode);
}
else
{
synctatus.text = "Synchronisiert!";
synctatus.color = new Color(0, 220, 0);
}
}
Re: ES3 Cloud Sync Problem with persistent DataPath
Hi there,
In your code here you are specifying an absolute path:
Whereas you should just specify a filename. I.e.
Relative paths such as filenames are relative to Application.persistentDataPath.
All the best,
Joel
In your code here you are specifying an absolute path:
Code: Select all
yield return StartCoroutine(cloud.Sync(Application.persistentDataPath + "/" + _filePath));
Code: Select all
yield return StartCoroutine(cloud.Sync( _filePath));
All the best,
Joel
Re: ES3 Cloud Sync Problem with persistent DataPath
Thank you Joel. That's an easy mistake. I fixed it and now it should work. I really appreciate your support
Re: ES3 Cloud Sync Problem with persistent DataPath
Glad that's all working for you now, let me know if you run into any other issues
All the best,
Joel
All the best,
Joel