Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using PlayFab;
- using PlayFab.ClientModels;
- using UnityEngine;
- using PlayFab;
- using PlayFab.Party;
- using PlayFab.ClientModels;
- public class PlayFabLogin : MonoBehaviour
- {
- public void Start()
- {
- //Note: Setting title Id here can be skipped if you have set the value in Editor Extensions already.
- if (string.IsNullOrEmpty(PlayFabSettings.TitleId))
- {
- PlayFabSettings.TitleId = "11845"; // Please change this value to your own titleId from PlayFab Game Manager
- }
- var request = new LoginWithCustomIDRequest { CustomId = "GettingStartedGuide", CreateAccount = true };
- PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnLoginFailure);
- }
- private void OnLoginSuccess(LoginResult result)
- {
- Debug.Log("Congratulations, you made your first successful API call!");
- PlayFabMultiplayerManager.Get().OnRemotePlayerJoined += OnRemotePlayerJoined;
- PlayFabMultiplayerManager.Get().OnRemotePlayerLeft += OnRemotePlayerLeft;
- }
- private void OnLoginFailure(PlayFabError error)
- {
- Debug.LogWarning("Something went wrong with your first API call. :(");
- Debug.LogError("Here's some debug information:");
- Debug.LogError(error.GenerateErrorReport());
- }
- private void OnRemotePlayerJoined(object sender, PlayFabPlayer player)
- {
- var localPlayer = PlayFabMultiplayerManager.Get().LocalPlayer;
- Debug.Log("localplayer"+localPlayer.ToString());
- }
- private void OnRemotePlayerLeft(object sender, PlayFabPlayer player)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement