question

Katerina Kritinina avatar image
Katerina Kritinina asked

Call AccountNotFound

Hello, I'm making my own multiplayer project with Photon Pun 2 and PlayFab. I started to make an account login system, but I need to somehow check its availability. I started to figure it out and there is an AccountNotFound error. How can I call it?

void Start()
    {
        ViborMenu.SetActive(true);
        PhotonNetwork.AuthValues = new AuthenticationValues(username);
        PhotonNetwork.AutomaticallySyncScene = true;
        username = PlayerPrefs.GetString("NickName");
        LoginUsingCustomId();
        PlayerNameAccount.text = PlayerPrefs.GetString("NickName");
        score = PlayerPrefs.GetInt("Score");
        lvlt.text = score.ToString() + "/100 LVL";
        PanelOfRegistry.SetActive(true);
        selected10skin = PlayerPrefs.GetInt("selectedSkin1", 1);
        adminKeyVerifInt = PlayerPrefs.GetInt("AdminKeyActivation", 1);
        if (PlayerPrefs.HasKey("NickName"))
        {
            PanelOfRegistry.SetActive(false);
        }
        health = maxHealth;
        health = PlayerPrefs.GetInt("Score");
        if (string.IsNullOrEmpty(PlayFabSettings.TitleId))
        {
            PlayFabSettings.TitleId = "secret";
        }


    }

    private void LoginUsingCustomId() ///hello
    {
        Debug.Log($" Login as{username}");
            var request = new LoginWithCustomIDRequest {CustomId = username, CreateAccount = true};
            PlayFabClientAPI.LoginWithCustomID(request, OnLoginCustomIdSucces, OnFailure);
        
    }

    

    private void UpdateDisplayName(string displayname)
    {
        var request = new UpdateUserTitleDisplayNameRequest {DisplayName = displayname};
        PlayFabClientAPI.UpdateUserTitleDisplayName(request, OnDisplayNameSuccess, OnFailure);
    }

    private void OnLoginCustomIdSucces(LoginResult result)
    {
        Debug.Log($"не лох {username}");
        UpdateDisplayName(username);
    }

    private void OnDisplayNameSuccess(UpdateUserTitleDisplayNameResult result)
    {

    }



    private void OnFailure(PlayFabError error) ///в
    {
        Debug.Log($"лох {error.GenerateErrorReport()}");
    }

    public void SetUsername(string name) {
        username = PlayerNameAccount.text;
    }

    public void Login()
    {
        LoginUsingCustomId();
    }


public void Create()
    {
        if (UserNameInput.text != "")
        {
                PlayerNameAccount.text = UserNameInput.text;
                PlayerPrefs.SetString("NickName", PlayerNameAccount.text);
                PlayerPrefs.Save();
                SceneManager.LoadScene("SampleScene");
                score += 2;
                PlayerPrefs.SetInt("Score", score);
                Menu2.reference.CloseDialogForLogin();
            
                
                
        }
        //PlayerNameAccount.text = UserNameInput.text;
        //PlayerPrefs.SetString("NickName", PlayerNameAccount.text);
        //PlayerPrefs.Save();
        //SceneManager.LoadScene("SampleScene");


    }

Account ManagementContent
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

Would you share the detailed error message and may I know in which API do you have this issue?

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.