Why am I not able to declare a GameObject ?

I get errors in Unity when I use this code.

	GameObject crowd;
	crowd = gameObject.FindGameObjectWithTag("Crowd(Clone)");
  • error CS1519: Unexpected symbol `=’ in class, struct, or interface member declaration
  • error CS1519: Unexpected symbol `(’ in class, struct, or interface member declaration

You need to pay attention to capitalization…“gameObject” refers to the object that the script is attached to, whereas “GameObject” is the class that contains the FindGameObjectWithTag function. By the way, are you sure have a tag called “Crowd(Clone)”? That sounds more like the name of an instantiated object, not a tag.

You need to call GameObject.FindGameObjectWithTag(“Crowd(Clone)”); using a capital G in GameObject.