I get an error every time I call to GUI inside my code. I’m not sure where this error sprung up from, but the same code has worked before.
private Rect namesRect = new Rect(0.0F, 0.0F, 0.0F, 0.0F);
protected override void OnGUI() {
GUI.Box(namesRect, "");
}
(this is simplified)
Assets/Scripts/ChatBox.cs(72,25): error CS0119:
Expression denotes a `method group', where a `variable', `value' or `type' was expected
This happens with all my GUI calls inside this method, and commenting out the whole of it just causes the errors to move to other files.
Note that this OnGUI() method isn’t actually a method from MonoBehaviour. I’ve made a class called Runnable that has a method called GUI() inside of it, which calls OnGUI(). All Runnables are added to an array inside a class called Game which does extend from MonoBehaviour and it’s OnGUI() method looks like this:
public void OnGUI() {
GUI.skin = guiSkin;
foreach(Runnable runnable in runnables) { runnable.GUI(); }
}
Basically, Game:OnGUI() -> Runnable:GUI() -> Runnable:OnGUI()
where Runnable:OnGUI()
is overridable