Sign In Register

How can we help you today?

Start a new topic
Answered

Unity SDK & Binary data helpers

Hi,


I want to do things neat and take advantage of the helpers to upload/download binary from Unity.

Therefore I am using the two methods : 

GameSparks.Api.GSHelper.GetUploadUrlRequestAndUploadFile(m_picture.EncodeToPNG(), "myPicture.png");
GameSparks.Api.GSHelper.GetDownloadableRequestAndDownloadFile();



The upload seems fine, I retrieve the uploadID, url, etc. 

But coming to the download, I'm not sure where to pass those information... Here is what I have so far, but it is obviously not working as "shortcode" and "uploadId" do not mean the same thing...

  

            GameSparks.Api.Requests.GetDownloadableRequest request = GameSparks.Api.GSHelper.GetDownloadableRequestAndDownloadFile();
            request.SetShortCode(r.m_pictureUploadID);
            request.Send((response) => 
            {
                if (!response.HasErrors)
                {
                    r.m_picture.LoadImage(response.JSONData["bytes"] as byte[]);
                }
                else
                {
                    Debug.Log("[GS] Impossible to download image... : " + response.Errors.ToString());
                }
            });

  


Best Answer

Hi Stephane,

The shortcode is a string so it would be .SetShortCode ("myShortCode")

In any case, check out this post: https://support.gamesparks.net/discussions/topics/1000050374


It contains a brief tutorial for uploading/downloading that you might find useful.

Thanks,


Oisin.




Answer

Hi Stephane,

The shortcode is a string so it would be .SetShortCode ("myShortCode")

In any case, check out this post: https://support.gamesparks.net/discussions/topics/1000050374


It contains a brief tutorial for uploading/downloading that you might find useful.

Thanks,


Oisin.



Hi Oisin,


Sure, I already followed this link and got the upload/download working.

But I did not understand how to use the helpers provided in the Unity SDK...


Anyway, I'll do without them ^^

Hi,


I also try to use the helper functions, but I don't understand what is this shortcode ? How is it related to the parameter of the message UploadCompleteMessage ?


Thank you

I'm also wondering what the shortcode is meant to be.

Login to post a comment