I have a problem with my game in Unity. The moment I boot it, through the console, I see this message: NullReferenceException: Object Reference Not Set on an Instance of an Object. I don't know what's possible. Since the game is working properly. The only thing that does not show the contents of the variable. I tested with a Debug to the variable and this takes the content. So it's not null.
My code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Managers;
using TMPro;
public class StateButtonChipsClub : MonoBehaviour
{
public GameObject ButtonChipsClub;
public bool isAdmin => TablesManager.Instance.club.isMyClub;
public int chipsAmount => TablesManager.Instance.club.clubChips;
public void Start()
{
if (isAdmin != true)
{
ButtonChipsClub.SetActive(false);
}
else
{
Debug.Log("CHIPS AMOUNT = "+chipsAmount.ToString());
ButtonChipsClub.GetComponent<TextMeshProUGUI>().text =
chipsAmount.ToString();
}
}
}