I'm trying to get the players DisplayName, I don't get any errors but the string is empty even tho I've set one from the Dashboard. What am I doing wrong here?
This is the code I'm using:
using UnityEngine; using PlayFab.ClientModels; using PlayFab; using TMPro; public class UserLogin : MonoBehaviour { [SerializeField] private TMP_InputField username; [SerializeField] private TMP_InputField password; public void LoginUser() { string uname = username.text; string pwd = password.text; var request = new LoginWithEmailAddressRequest { Email = uname, Password = pwd }; PlayFabClientAPI.LoginWithEmailAddress(request, OnLoginSucess, OnFailure); } private void GetAccountInfo(string PID) { var request = new GetPlayerProfileRequest { PlayFabId = PID, ProfileConstraints = new PlayerProfileViewConstraints() { ShowDisplayName = true } }; Debug.Log("PlayFabID: " + PID); PlayFabClientAPI.GetPlayerProfile(request, OnInfoSuccess, OnFailure); } void OnInfoSuccess(GetPlayerProfileResult result) { Debug.Log("Displayname: " + result.PlayerProfile.DisplayName); } private void OnLoginSucess(LoginResult result) { Debug.Log("You are logged in! " + result.PlayFabId.ToString()); GetAccountInfo(result.PlayFabId); } private void OnFailure(PlayFabError error) { Debug.LogError("Something went wrong >>\n" + error.ErrorMessage); } }