[Solved] public Text text not working

I am trying to create my own text based game that functions similarly to this so I can practice. I am running into an issue. I have added my UityEngine.UI, but my public Text text defalcation is not turning blue or being recognized. I haven’t gotten very far into my story line. The errors that are popping up are in the screen shot.

I am confused on where I have not set an instance, maybe I am misunderstanding how an instance works?
Line 7

Thank you

I don’t know if it is an artefact of the way you copied your code, but line 7, where text is declared, is missing a semicolon.

Other than that, have you dragged the Text object into the field in the Unity Inspector? Leaving that empty is a common cause of the null reference error.

2 Likes

I definitely did not drag the text object into the inspector field. I mustve not written down that step. Thank you.

1 Like

Privacy & Terms