question

islesofcircadia avatar image
islesofcircadia asked

PlayFab Unity Callback Parameter Passthrough?

Hello All,

I currently have an authoritative server that has a chain of events to. Create a list of items the player owns, create a new character on the user account and then load that item list into the new character inventory. However, I'm having issues with finding a way to pass through some vital information to the success callback.

Ex.

#region GRANT CHARACTER TO PLAYER
    //GRANT CHARACTER TO PLAYER
    //Makes Playfab API Call to create the player a new user character and result is the character ID


    public void PlayFabCreateCharacter(string playfabID)
    {
        var request = new GrantCharacterToUserRequest { PlayFabId = playfabID, CharacterName = playfabID, CharacterType = "Test"};

        PlayFabServerAPI.GrantCharacterToUser(request, GrantCharacterSuccess, GrantCharacterFailure);
    }


    private void GrantCharacterSuccess(GrantCharacterToUserResult obj)
    {
        PlayFabLoadCharacterInventory("I NEED PLAYFABID HERE", obj.CharacterId);
    }


    private void GrantCharacterFailure(PlayFabError obj)
    {
        Debug.Log(obj.GenerateErrorReport());
    }
    #endregion

---------------------------------------------------------------------------------------

Within the success callback I need to have the PlayFabID that I used to create the character to also grant the character items as well as the characterID that was created. passing the character ID is easy because its in the result, however, the PlayFABID for that connected client is not.

I also have to pass through a list of objects from another API call to my backend DB.

I saw an old post from 2014 saying pass-through-to-callback parameters were on the backlog, is this true?

Thank you,

apisCharacters
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

·
Gosen Gao avatar image
Gosen Gao answered

The PlayFabId is contained in the obj.Request. You can convert it to Json object to get the PlayFabId.

10 |1200

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

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.