I'm using GetAccountInfo to get the info I need:
var requestCustomId = new GetAccountInfoRequest(); PlayFabClientAPI.GetAccountInfo(requestCustomId, OnGetAccountInfoSuccess, OnGetFailure);
After that, I need to do different things if my user has CustomId, or don't. For this, I used if...else:
if(result.AccountInfo.CustomIdInfo.CustomId != null){ CustomIdString.text = result.AccountInfo.CustomIdInfo.CustomId; } else { CustomIdString.text = "It's null"; }
When my user has CustomId, everything works fine. But when my user has no CustomId linked I'm getting NullReferenceException:
NullReferenceException: Object reference not set to an instance of an object LoginWindowView.OnGetAccountInfoSuccess (PlayFab.ClientModels.GetAccountInfoResult result) (at Assets/Scripts/UI/LoginWindowView.cs:173)
the line 173 is:
if(result.AccountInfo.CustomIdInfo.CustomId != null){
Someone can help me??