Unity and PlayFab Leaderboard

Viewed 10

I seem to be struggling with the below script. It keeps telling me Object reference not set to an instance of an object LoseScene.Start () (at Assets/Scripts/LoseScene.cs:17)

public class LoseScene : MonoBehaviour { public PlayfabManager playfabManager;

[SerializeField] private TMP_Text _scoreText;

private void Start()
{
    var score = PlayerPrefs.GetInt("score");
    _scoreText.text = score.ToString();
    playfabManager.SendLeaderboard(score);
}

public void RestartGame()
{
    SceneManager.LoadScene(1);
}

public void QuitToMenu()
{
    SceneManager.LoadScene(0);
}

}

0 Answers
Related