Dear all,
So I found below code from the internet and try to use it for my score board system. Somehow I cannot get it works. What am I missing here. The codes looks ok comparing to the PunPlayerScores script.
public int fruitScore = 0;
private PhotonView PV;
void Update()
{
PV = GetComponent<PhotonView>();
}
private void OnTriggerEnter(Collider target)
{
if (target.tag == "enemy")
{
ApplyScoreToOwner();
}
}
private void ApplyScoreToOwner()
{
if (PV.IsMine)
{
Hashtable hash = new Hashtable();
fruitScore = Convert.ToInt32(GetComponent<PhotonView>().Owner.CustomProperties["score"]);
hash.Add("score", fruitScore + 1);
PV.Owner.SetCustomProperties(hash);
}
}