Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Problem with Database (using Photon)

Discussion in 'Scripting' started by IbrahimAlkaber, Apr 12, 2020.

  1. IbrahimAlkaber

    IbrahimAlkaber

    Joined:
    Dec 9, 2019
    Posts:
    53
    Hello, I made a room where the players are entering it (I use a photon) but I have a problem, when a player enters the room he cannot see the status of the other player in the room and also the other player cannot see the player who just entered as shown in the picture.

    https://i.imgur.com/SrA4gGA.png
    https://i.imgur.com/MYTj3JO.png

    Code (CSharp):
    1.     [SerializeField] public Text PlayersMoney;
    2.     [SerializeField] public Text PlayersScore;
    3.     private bl_DataBase DataBase;
    4.  
    5.  
    6.     private void Start()
    7.     {
    8.         DataBase = bl_DataBase.Instance;
    9.         StartCoroutine(IEGetInfo());
    10.     }
    11.  
    12.     IEnumerator IEGetInfo()
    13.     {
    14.         WWWForm wf = new WWWForm();
    15.         string hash = bl_DataBaseUtils.Md5Sum(DataBase.LocalUser.NickName + bl_LoginProDataBase.Instance.SecretKey).ToLower();
    16.         wf.AddField("typ","1");
    17.         wf.AddField("name", DataBase.LocalUser.NickName);
    18.         wf.AddField("hash", hash);
    19.  
    20.         using (UnityWebRequest www = UnityWebRequest.Post(bl_LoginProDataBase.Instance.GetUrl(bl_LoginProDataBase.URLType.DataBase), wf))
    21.         {
    22.             yield return www.SendWebRequest();
    23.             if (www.error == null && !www.isNetworkError)
    24.             {
    25.                 if (www.isDone) {
    26.  
    27.                       PlayersScore.text = DataBase.LocalUser.Score.ToString();
    28.                      PlayersMoney.text = DataBase.LocalUser.Coins.ToString("n0");
    29.                 }
    30.                 else
    31.                 {
    32.                     Debug.LogWarning(www.downloadHandler.text);
    33.                 }
    34.             }
    35.             else
    36.             {
    37.                 Debug.LogError(www.error);
    38.             }
    39.         }
    40.     }
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    The description and images you provided are somewhat vague. Could you provide a little more information about what the screenshots are showing and what you expected to see in the screenshots, and how that differs from what you are actually seeing?
     
    IbrahimAlkaber likes this.
  3. IbrahimAlkaber

    IbrahimAlkaber

    Joined:
    Dec 9, 2019
    Posts:
    53
    Hi @PraetorBlue,
    It is assumed that any player entering the room shows the status of other players, such as their money, points, etc., but the problem is that the status is repeated and taken from the player who was previously in the room, I want any player entering a room that shows other players his own status

    In the video, when someone entered my room, my status was repeated and this problem I want his own status to show to me
     
  4. IbrahimAlkaber

    IbrahimAlkaber

    Joined:
    Dec 9, 2019
    Posts:
    53
    Does it works if i use isMine photon?