I have the following method:
void setTexts()
{
if (queueIn != null)
{
queueIn.text = countIn.ToString();
}
if (queueOut != null)
{
queueOut.text = waitingForPickup.ToString();
}
}
I want it to do nothing if queueIn is null, but I keep getting a null reference exception saying queueIn is null. Why is it going into the if block when queueIn is null?
EDIT: the problem disappeared when I added a Debug.Log check, so it probably hadn't saved the previous dozen times or something. Thanks for your suggestions! I'm pretty new to C#.