A namespace does not directly contain members such as fields or methods

Hi on the void Update () it gives me this error and I can’t understand why cause i didn’t do anything.
on the line 43
code:https://gist.github.com/anonymous/98fe16a1bc2391d8bf421a39d5825337

It looks like you are missing a } at the very end. Missing brackets and semicolons sometimes result in strange error messages like that.

1 Like
public class NumberWizard : MonoBehaviour 
{
  // put the Update() inside the class braces as the class needs to know where they are
 // as they are part of the MonoBehaviour
}
  // not here as its out of scope

see if that helps

as a note, in MonoDevelop, if you click to the right of an opening { brace, it will highlight the corresponding closing brace if you scroll down.
if you do that you can see your class closing brace is on line 38, so just move that to the end, and this will encompass the Update() method in the class.

1 Like

thanks :slight_smile:

Privacy & Terms