So, remember how I mentioned C# was case-sensitive in my previous post
If you look at the first error the compiler is telling you that it can’t find a method called “States_sheets_0()”. If you look at your code you have a method called “states_sheets_0()”.
To emphasise the difference;
So, in your
Update() method, simply lower-case the “S” in the methd call for
Regarding the second issue, an object reference required implies that for something it cannot refer the object. It refers to
Text.text - this is the text property of the object of type Text.
If we look at your code to see where that is used we can see that you set the text that you want to appear on the screen in two places,
void state_cell() and
void states_sheets_0(), both of these methods are trying to access the text property of the a Type type object, which, in this case, just to blow your mind is actually named “text” also.
So, look to the top of your script where you declare this variable, it all looks good. You made it public, now why was that? This was so that it was accesible from outside of this class. What would want to access it? The Inspector within the Unity editor in this case.
If you selected your TextController game object in the Hierarchy and then click on the Inspector you will see that your publicly exposed variable called “text” is displayed as a field which I suspect is empty. What you need to do here is drag the UI Text game object which you added to display the text in the scene from the Hierarchy into this field.
This will create the reference which your error message is stating it is missing.
Also, if you haven’t already, please do read the link I gave you for formatting your code when you post in the forum, it makes it a lot easier to read for other people who may be trying to help you
Hope this helps