Preprocessor directives must appear as the first non-whitespace character on a line Here are some solutions collected. 1. event, you must have a method with the same name declared in the code behind page like below, protected void #btnLogin_Click(object sender, EventArgs e) { } But in C# cs files, as the error explains preprocessor directives ( # ) must appear as the first non-whitespace character that's why the error happens. Solution would be to adhere to proper naming conventions. See here . 2. Preprocessor directives start with # . You have a trailing # in line 10. It looks like you use Visual Studio which should mark the line in red. Also the error should tell you which line looks wrong. Edit: You probably just opened the file in Visual Studio, which will not load any assemblies. Please open your C# project from Unity, right-click in the project explorer and choose "open C# project" or similar Honestly this post should be removed for low effort, a simple Goo
Unity3diy is a blog for unity game developers. We publish latest from unity asset store, unity game engine, unity software, unity technologies, unity games. Also unity packages and assetstore like uni tabs unity, paint 3d, qooapp, unity performance tool and an object reference is required for the non-static field.