question

manolhsplaths46 avatar image
manolhsplaths46 asked

anyone has discord?

hey i am looking for someone to explain me how to use playfab,if any of you have time please help me out.

i would like to understand how to put code from playfab to c# script.

if u have skype or discord or anything post it below or pm me

or if there is a discord group from this community that i can join

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

This forum site is actually the best place to ask questions and get answers, but we also have a number of tutorials here (https://api.playfab.com/docs/tutorials) and a Slack you can join as part of our sign-up process, for community discussions. I've sent you an invite for that. To be clear, the forums are where we provide official support - the Slack channels are for community discussions, though we do occasionally pop into discussions there.

8 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

manolhsplaths46 avatar image manolhsplaths46 commented ·

for example i have this function when i call it , it updates the score,but i want to update the score only when my score is higher than the current score :

 public void SaveStats()
    {
  
        // Neue Anfrage erstellen
        var request = new UpdatePlayerStatisticsRequest();
        // Liste mit Statistiken
        request.Statistics = new List<StatisticUpdate>();
        // Neuen Wert für Statistik anlegen
        var stat = new StatisticUpdate { StatisticName = "Coins", Value = GameManager.Instance.score};
        // Eintrag hinzufügen
        request.Statistics.Add(stat);
        // Anfrage an PlayFab API starten
        PlayFabClientAPI.UpdatePlayerStatistics(request, OnSetStatsSuccess, OnPlayFabError);

    }

In unity i know that i can set an integer like

public int highscore;

if i knew how to get the topscore of my currentplayer and compare with an if statement it would be easy to fix my problem but in order to do that i need to reference the highscore that is located in playfab if that makes so that i can do

if(Score > Highscore){

var stat = new StatisticUpdate { StatisticName = "Coins", Value = GameManager.Instance.score};

}

0 Likes 0 ·
brendan avatar image brendan manolhsplaths46 commented ·

Re-posting your questions multiple times in different threads doesn't really help get you answers any faster - all it does is fragment the information about your questions in multiple places, which makes it difficult for others to understand the information later. So let's keep this to the original thread where you asked about this: https://community.playfab.com/questions/24215/how-to-increase-score-when-the-currentscore-is-hig.html

0 Likes 0 ·
manolhsplaths46 avatar image manolhsplaths46 commented ·

In your tutorials or documentation i see this code and i have no idea how to convert this to unity c#, if that makes sense..


{ "code": 200, "status": "OK", "data": { "Statistics": [ { "StatisticName": "Headshots", "Value": 10, "Version": "3" }] } }

And this leaves me with so many questions like

do i need to use authentication everytime i want to do something?
Do i need to make a whole function to use playfab functionality?
How do i reference stuff like in my case statistic name , or statistic value?

How do i get the statisticvalue to be display on my screen as a highscore and so on, i can't do this things if i don't know how to reference the stuff and sometimes i wish i could find someone to answer me directly... So that i can understand properly :(

0 Likes 0 ·
brendan avatar image brendan manolhsplaths46 commented ·

I'm sorry to hear that you're struggling with how to use the API calls. We've worked to make them as simple as possible, but we're happy to help out where you have issues.

What you've posted above is a response from PlayFab, not an API call, so it's not clear what you mean by "converting" it. Unless you're asking how to use the response? If so, it's a simple JSON data package, so you would dereference the data as you would with any other standard Web API call - plenty of examples of this are available in our Unity SDK, but let us know if you're having trouble using it.

Specific to your other questions:

No, you only have to authenticate once, at the start of the player session. If the player is logged in for more than 24 hours, you will need to re-login to get a new Session Ticket, since they expire after 24 hours, but the error response from any Client API call will let you know if the ticket is no longer valid. I'd recommend having a look at our auth tutorial for this.

"Whole function": I'm not sure what you mean. All PlayFab API calls are simple Web API calls. Can you clarify your question?

For the statistics, let's keep that follow-up in the other thread you started on that topic.

0 Likes 0 ·
manolhsplaths46 avatar image manolhsplaths46 brendan commented ·

pff i had no idea this was a new programming language called json or something pff i thought it was an example on how to use it lmao :P
No wonder ,people don't ask many questions because they learned json and know how to use it.

1.A whole function i meant in unity we write a function like

void myFunction(){do something}



I noticed in tutorials that codes are always requiring a function


0 Likes 0 ·
Show more comments
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.