Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by anudeep · Mar 21 at 01:50 AM · Player Dataunity3ddataentities

Trouble uploading a text file as an entity file onto playfab.

After some research I decided to to upload my player's level progress which is huge dictionary in a text file as an entity file.

Following the link below,

https://docs.microsoft.com/en-us/gaming/playfab/features/data/entities/quickstart

I get the following error in PlayFabHttp.SimplePutCall() :

error CS1503: Argument 3: cannot convert from 'method group' to 'Action<byte[]>'

the method group it's talking about is void FinalizeUpload()


And how am i supposed to input my text file name here ? payloadstr?

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Made Wang · Mar 21 at 07:56 AM

FinalizeUpload is a callback method, it needs to accept data, even if you don't use the data. Refer to the writing in the example:

void FinalizeUpload(byte[] data){}

In FinalizeUpload, you need to call FinalizeFileUploads to complete the file upload. The file name you need to pass in here should be the same as the file name you passed in when calling InitiateFileUploads. You can use it as a global variable.

PayloadStr refers to the content of this file, you need to convert it to a byte array and pass it as the second parameter in SimplePutCall.

Comment
anudeep

People who like this

1 Show 8 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image anudeep · Mar 21 at 01:59 PM 0
Share

Okay! I am successfully able to Put and Get a entity file, however it is empty.

My game basically generates a text file (savedtextfile.txt for examples), which is in my resources. How can I upload that file with data in it, onto playfab instead of actually making a new empty entity file named savedtextfile.txt

avatar image Made Wang anudeep · Mar 22 at 06:30 AM 0
Share

As said above, you need to convert the content of the file to a byte array and pass it as a parameter to SimplePutCall. If you are getting the file in Unity's resources folder you can refer to the code below, in addition, you can also use the IO stream to get the file.

TextAsset txt = Resources.Load("test") as TextAsset;
string payloadStr = txt.text;
byte[] payload = Encoding.UTF8.GetBytes(payloadStr);
PlayFabHttp.SimplePutCall(response.UploadDetails[0].UploadUrl,
    payload,
    FinalizeUpload,
    error => { Debug.Log(error); }
);
avatar image anudeep Made Wang · Mar 22 at 01:57 PM 0
Share

Thank you so much! Wasn't able to understand where to put my text. And how do I download it and retrieve the text within?

Show more comments
avatar image anudeep anudeep · Mar 24 at 11:58 AM 0
Share

Okay! Got it. But I ended up using the url to download the file to my persistentDataPath and access it from there.

avatar image Made Wang anudeep · Mar 25 at 06:53 AM 0
Share

Ok, if you still have questions please feel free to let us know.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Upload JSON file Unity (entity) 2 Answers

    Store a list of variable values for all players,Store a list of values that constantly changes 1 Answer

    Entity Objects, Entity Files or Legacy player data 1 Answer

    How to upload data to playfab in game 2 Answers

    Can we do action when Leaderboard is reset? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges