[OnPhotonPlayerPropertiesChanged] not raising

Hi everyone, Im working with photon for few weeks now and everything is great ! I have encountered a problem lately and I can't figure out the answer. Here is the code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ExitGames.Client.Photon;
using Photon.Pun;
using Photon.Realtime;
using Hashtable = ExitGames.Client.Photon.Hashtable;


public class PlayerManager : MonoBehaviourPunCallbacks
{

    void OnPhotonPlayerPropertiesChanged(object[] playerAndUpdatedProps) 
    {
        Photon.Realtime.Player player = playerAndUpdatedProps[0] as Photon.Realtime.Player;
        Hashtable props = playerAndUpdatedProps[1] as Hashtable;

        Debug.Log("test 0");
        if (player.CustomProperties.ContainsKey("1"))
        {
            Debug.Log("test 1");
        }
    }
}


When I'm playing with one or more players and change a custom properties (with Player.SetCustomProperties(hash)) the Debug.Log("test 0") never show up.

I have tried everything and it feels like i'm missing something crucial, any help is welcome !

Best Answer

  • JohnTube
    JohnTube mod
    Accepted Answer

    Hi @Heavell,

    Thank you for choosing Photon!

    You're using the callback from PUN Classic in PUN 2, the callback should be "OnPlayerPropertiesUpdate(Player, Hashtable)" instead.

    See the list of changes here and the callbacks migration table at the bottom.

Answers

  • JohnTube
    JohnTube mod
    Accepted Answer

    Hi @Heavell,

    Thank you for choosing Photon!

    You're using the callback from PUN Classic in PUN 2, the callback should be "OnPlayerPropertiesUpdate(Player, Hashtable)" instead.

    See the list of changes here and the callbacks migration table at the bottom.