using System.Collections; using System.Collections.Generic; using UnityEngine; using PlayFab; using PlayFab.ClientModels; using TMPro; public class PlayfabManager : MonoBehaviour { public TMP_Text loginTXT; [Header("Values")] public string ammoAmount; public string medkitAmount; public string srvAmount; [Header("TXT")] public TMP_Text ammoTXT; public TMP_Text medkitTXT; public TMP_Text srvTXT; Menu menu; // Start is called before the first frame update void Start() { Login(); menu = GetComponent<Menu>(); } private void Update() { } void Login() { var request = new LoginWithCustomIDRequest { CustomId = SystemInfo.deviceUniqueIdentifier, CreateAccount = true }; PlayFabClientAPI.LoginWithCustomID(request, OnSuccess, OnError); } public void GetData() { PlayFabClientAPI.GetUserData(new GetUserDataRequest(), OnDataRecieved, OnError); } void OnDataRecieved(GetUserDataResult result) { Debug.Log("Recieved"); if (result.Data != null) { loginTXT.text = "Recieved"; ammoTXT.text = "Ammo : " + result.Data["Ammo"].Value; medkitTXT.text = "Medkit : " + result.Data["Medkit"].Value; srvTXT.text = "SRV : " + result.Data["Survival"].Value; } else { loginTXT.text = "Recieved but not loaded"; } } public void SaveData() { var request = new UpdateUserDataRequest { Data = new Dictionary<string, string> { {"Ammo", menu.ammoAmount.ToString()}, {"Medkit", menu.medkitAmount.ToString()}, {"Survival", menu.srvAmount.ToString()} } }; PlayFabClientAPI.UpdateUserData(request, OnDataSend, OnError); } void OnDataSend(UpdateUserDataResult result) { Debug.Log("User Data Send"); } void OnSuccess(LoginResult result) { Debug.Log("Successfully loggin Account Created"); GetData(); loginTXT.text = "Logged In"; } void OnError(PlayFabError error) { Debug.Log("Error while login"); loginTXT.text = "Error"; } }
hello, I am using unity game engine and the code is working on unity editor but when I build it, it not able to load anything from server.... please help me... I am using this code this is fully working on the editor but not when I build it for android do I need to do some specific setting for build.... please help...