I got this error
Assets\leaderboard.cs(34,48): error CS1061: ‘Player’ does not contain a definition for ‘GetScore’ and no accessible extension method ‘GetScore’ accepting a first argument of type ‘Player’ could be found
I used a tutorial I found to try and recreate it but I can’t figure out how to make this work
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using TMPro;
using System.Linq;
public class Leaderboard : MonoBehaviour
{
public GameObject playerHolder;
[Header("Options")]
public float refreshRate = 1f;
[Header("UI")]
public GameObject[] slots;
[Space]
public TextMeshProUGUI[] scoreText;
public TextMeshProUGUI[] nameText;
private void Start()
{
InvokeRepeating(nameof(Refresh), 1f, refreshRate);
}
public void Refresh()
{
foreach (var slot in slots)
{
slot.SetActive(false);
}
if (PhotonNetwork.PlayerList.Length > 0)
{
var sortedPlayerList = PhotonNetwork.PlayerList.OrderByDescending(player => player.CustomProperties.ContainsKey("score") ? (int)player.CustomProperties["score"] : 0).ToList();
int i = 0;
foreach (var player in sortedPlayerList)
{
slots[i].SetActive(true);
if (string.IsNullOrEmpty(player.NickName))
player.NickName = "Unnamed";
nameText[i].text = player.NickName;
int playerScore = player.CustomProperties.ContainsKey("score") ? (int)player.CustomProperties["score"] : 0;
scoreText[i].text = playerScore.ToString();
i++;
}
}
else
{
Debug.LogWarning("GET OUT");
}
}
private void Update()
{
playerHolder.SetActive(Input.GetKey(KeyCode.Tab));
}
}