question

kimui32111 avatar image
kimui32111 asked

PlayFabID returning blank?

Not sure if this is the correct place but when I try GetAccountInfoRequest for PlayFabID it seems to return nothing.

Maybe I'm doing something wrong.

I'm trying to get PlayFabID to access the character table (trying to store experience / level / stats in there so people cant cheat) unless theres another way to do it and im just dumb. thanks for the help :]

[ This is how I login ]

    public void Login()
    {
        lRequest = new LoginWithPlayFabRequest();
        lRequest.Username = user.text;
        lRequest.Password = password.text;
        PlayFabClientAPI.LoginWithPlayFab(lRequest, result =>
        {
            errorMessage = "Logged In";
        }, error =>
        {
            Debug.Log(errorMessage = error.ErrorMessage);
        }, null);


    }

[ This is the script where the PlayFabID is set (just to test and see if it works) it stays blank when logging in. ]

    public string PlayFabID = "";


    private void Start()
    {
        if (PlayFabClientAPI.IsClientLoggedIn())
        {
            accountInfoReq = new GetAccountInfoRequest();


            
            PlayFabClientAPI.GetAccountInfo(accountInfoReq, result => {
                Debug.Log("Got account info");
                PlayFabID = accountInfoReq.PlayFabId;
            }, error => {
                Debug.Log("Failed to get account info");
            }, null);


        }
    }

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

·
kimui32111 avatar image
kimui32111 answered

Nevermind, I've figured out the issue.

for anyone dumb like myself:

        if (PlayFabClientAPI.IsClientLoggedIn())
        {
            PlayFabClientAPI.GetAccountInfo(new GetAccountInfoRequest(), result => {
                Debug.Log("Got account info");
                PlayFabID = result.AccountInfo.PlayFabId;
            }, error => {
                Debug.Log("Failed to get account info");
            }, null);


        }
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.