Trouble with DownloadFile Method - Need Assistance

Discussion and help for Easy Save 3
Post Reply
dev_PmaInc
Posts: 11
Joined: Thu Nov 30, 2023 3:20 pm

Trouble with DownloadFile Method - Need Assistance

Post by dev_PmaInc »

Hey everyone,

I hope you're doing well. I've been facing a bit of a challenge with the DownloadFile method in my Unity project, and I was wondering if anyone can help me.

Here's a snippet of the code I'm working with:

Code: Select all

public IEnumerator LoadFile()
{
    // Create a new ES3Cloud object with the URL to our ES3.php file.
    var cloud = new ES3Cloud(url, apiKey);

    //cloud.downloadProgress;
    yield return StartCoroutine(cloud.DownloadFile(path, user, password));

    if (cloud.isError)
        Debug.LogError(cloud.error);

    SaveManager saveMng = ScriptManager.GetScript_SaveManager();
    saveMng.LoadBoutonClicked(path);
}
The issue I'm encountering is that I sometimes need to invoke the LoadFile method multiple times (like 1, 2, or 3 times) before it successfully downloads the file. I have verified that the path is correct, remains consistent, and exists in the database.

Thanks in advance for your help!
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Trouble with DownloadFile Method - Need Assistance

Post by Joel »

Hi there,

If you need to invoke it multiple times for it to work then it would indicate an issue at your server's side, so you would need to get them to perform tests at their end and/or check their logs to see what is happening.

Also just in case you weren't aware, the download won't happen immediately and you do need to wait for the download to finish (which is what the coroutine is for).

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
dev_PmaInc
Posts: 11
Joined: Thu Nov 30, 2023 3:20 pm

Re: Trouble with DownloadFile Method - Need Assistance

Post by dev_PmaInc »

Hi Joel,

Thanks for your response.

I understand that coroutines need time to execute, and I've been patient, waiting for the download to finish. However, even after waiting for 5 minutes, nothing seems to happen, and it typically takes only 2 seconds when it works normally.

Regarding the server side, shouldn't the Debug.LogError(cloud.error); statement provide some information when such issues occur? I find it surprising that there's no error message despite the extended delay.

Your assistance is greatly appreciated!
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Trouble with DownloadFile Method - Need Assistance

Post by Joel »

Hi there,

If the server isn't sending a response then there won't be any error and the request generally won't complete. If you replicate this in a new project with a very simple scene and send it to me on moodkie.com/contact with step by step instructions I'm happy to take a look but I can't help with server-side issues.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
dev_PmaInc
Posts: 11
Joined: Thu Nov 30, 2023 3:20 pm

Re: Trouble with DownloadFile Method - Need Assistance

Post by dev_PmaInc »

Hello,

Apologies for the delayed response. I've identified the issue. It turns out I was closing a popup too quickly with a script inside. Since the initial download took longer, the script wasn't able to be done properly once the download finished, because he couldn't find the other script. I apologize for taking up your time.

Best regards,
William
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Trouble with DownloadFile Method - Need Assistance

Post by Joel »

Glad you managed to find the issue WIlliam :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply