I'm using Unity.
I'm followed the "Getting Started" post here
https://api.playfab.com/docs/getting-started-with-playfab
I made an empty game object and attached the script to it.
I get these errors:
Error #1
Error logging in player with custom ID:
UnityEngine.Debug:Log(Object)
PlayFabManager:<Login>m__1(PlayFabError) (at Assets/PlayFabManager.cs:33)
PlayFab.<LoginWithCustomID>c__AnonStorey2A:<>m__4E(String, PlayFabError) (at Assets/PlayFabSDK/Public/PlayFabClientAPI.cs:195)
PlayFab.Internal.<MakeRequestViaUnity>c__Iterator0:MoveNext() (at Assets/PlayFabSDK/Internal/PlayFabHTTP.cs:249)
Error #2
Couldn't resolve host '.playfabapi.com'
UnityEngine.Debug:Log(Object)
PlayFabManager:<Login>m__1(PlayFabError) (at Assets/PlayFabManager.cs:34)
PlayFab.<LoginWithCustomID>c__AnonStorey2A:<>m__4E(String, PlayFabError) (at Assets/PlayFabSDK/Public/PlayFabClientAPI.cs:195)
PlayFab.Internal.<MakeRequestViaUnity>c__Iterator0:MoveNext() (at Assets/PlayFabSDK/Internal/PlayFabHTTP.cs:249)
My Code: (I substituted my GameTitleId with "XXXX" for this post)
using UnityEngine;
using System.Collections;
using PlayFab;
using PlayFab.ClientModels;
public class PlayFabManager : MonoBehaviour {
public string PlayFabId;
void Login(string titleId)
{
LoginWithCustomIDRequest request = new LoginWithCustomIDRequest()
{
TitleId = titleId,
CreateAccount = true,
CustomId = SystemInfo.deviceUniqueIdentifier
};
PlayFabClientAPI.LoginWithCustomID(request, (result) => {
PlayFabId = result.PlayFabId;
Debug.Log("Got PlayFabID: " + PlayFabId);
if(result.NewlyCreated)
{
Debug.Log("(new account)");
}
else
{
Debug.Log("(existing account)");
}
},
(error) => {
Debug.Log("Error logging in player with custom ID:");
Debug.Log(error.ErrorMessage);
});
}
// Use this for initialization
void Start () {
Login ("XXXX");
}
// Update is called once per frame
void Update () {
}
}
Please advise what I'm doing wrong or if this is supposed to be the result. I thought it's supposed to create a new player account and return a newly generated PlayFabId?