using Photon.Pun; using System.Collections; using System.Collections.Generic; using UnityEngine; public class SetCharacterName : SetNickName { [SerializeField] protected StringSharedField playerAccountName; protected PlayerAccountData accountData; protected override void Start() { base.Start(); accountData = PlayerDataHandler.Instance.LoadPlayerAccountData(playerAccountName.Value); } public override void OnInputFieldChanged(string value) { if(accountData != null) { if (accountData.PlayerContainsCharacter(value)) { button.interactable = false; return; } } base.OnInputFieldChanged(value); } public void SaveCharacterOnAccountData() { accountData.AddCharacterToPlayerAccount(insertedName.Value); PhotonNetwork.NickName = insertedName.Value; PlayerDataHandler.Instance.SavePlayerAccountData(playerAccountName.Value, accountData); } }