Architha Shastry
Architha Shastry

Reputation: 41

aws mobile sdk for unity- How do I get the progress of download from amazon server(using amazon s3)

I am using aws unity sdk for my unity game to download the assets stored in amazon server.I used GetObjectAsync() for download.In the aws sdk for iOS,we get the progress value from NSUrlSessionDelegates.But I want to use aws mobile sdk for unity and get the progress value of download.How do I do this? Please help.

private void GetObject()
{
    ResultText.text = string.Format("fetching {0} from bucket {1}",
    SampleFileName, S3BucketName);
    Client.GetObjectAsync(S3BucketName, SampleFileName, (responseObj) =>
    {
       string data = null;
       var response = responseObj.Response;
       if (response.ResponseStream != null)
       {
          using (StreamReader reader = new StreamReader(response.ResponseStream))
          {
             data = reader.ReadToEnd();
          }

          ResultText.text += "\n";
          ResultText.text += data;
       }
  });
}

Upvotes: 0

Views: 1167

Answers (2)

Caesar
Caesar

Reputation: 281

I have the same problem and I tried to ask on AWS forum.

Unfortunately they doesn't support yet.

Here the link:

https://forums.aws.amazon.com/thread.jspa?threadID=248187&tstart=0

To access of forum is necessary to login.

Upvotes: 0

Programmer
Programmer

Reputation: 125375

You can do that. Here is snippet from Amazon develper website.

public event EventHandler<WriteObjectProgressArgs> WriteObjectProgressEvent

TransferUtilityDownloadRequest request = new TransferUtilityDownloadRequest();
request.WriteObjectProgressEvent += displayProgress;

private void displayProgress(object sender, WriteObjectProgressArgs args)
{
    Console.WriteLine(args);
}

Upvotes: 1

Related Questions