using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
The above are directives that instruct your class to use any of those namespaces, they allow you to access other classes that are within. The reason I asked for the full script was because it was difficult to see if you had a missing semi-colon for example after one of them, which may cause you this problem.
Most of those you don’t actually need anyway, unless you are doing something that specifically accesses something from within one. For example, your line;
public Text text;
would error if you didn’t have;
using UnityEngine.UI
as the compiler wouldn’t know what the type Text was in this context.
The fact that your game runs indicates that there isn’t a problem with your code. I’ve taken a copy of the code from the link you provided and pasted it into Visual Studio, this is how it looks for me;
as you can see, States
is in lightblue, which indicates all is good. What this suggests is perhaps your installation of MonoDevelop has a problem with the syntax highlighting.
Within MonoDevelop try going to Tools > Preferences and then click on the Text Editor tab, there should be an item for syntax highlighting, if there’s nothing obvious, can you pop a screenshot of that up, as I’ve not used it for some time.
Incidentally, Visual Studio is a much more advanced development environment, so if you have continued problems I would recommend switching to Visual Studio, there is now a Mac version and you can get it for free. MonoDevelop is actually built using an open source version of what Visual Studio was, once upon a time, as such it’s a little further being in the development time frame.
Also, note how in my screenshot the using System.Collections;
is greyed out, that’s because Visual Studio lets you know if you are referencing things that you don’t actually need, as such you could remove that line altogether and you’d still be fine - quite a handy feature.