I Need A C# Script For Unity That I Can Use Text Mesh Pro To Display Ban Reason And Hours Left Of Ban.
If the Text Mesh Pro you mean the “Text -TextMeshPro” component under the Unity Editor UI section, here is the code example you can refer to:
//TextMeshPro text component, set the value in the Unity Editor
public TMP_Text text;
void Login()
{
PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest
{
CustomId = "test"
}, re =>
{
Debug.Log("Login Success!");
}, er =>
{
if (er.Error == PlayFabErrorCode.AccountBanned)
{
foreach (var item in er.ErrorDetails)
{
Debug.Log("Reason : " + item.Key + "\t" + "Expires : " + item.Value[0]);
//use TextMeshPro text component to display text
text.text += item.Value[0].ToString();
}
}
Debug.Log(er.GenerateErrorReport());
});
}
Please remember to check Allow client to view ban reason and duration in Game Manager-> Title settings-> API Features.
2 People are following this question.